whats the difference between using .duration(wakeInSeconds * 1000)
and .duration(60min)
. are they interchangeable??
@grimm ,
Good question, if wakeInSeconds = 3600 then there is no difference at all. The reason I use wakeInSeconds is that I want the device to sleep until the top of the hour irregardless of when during the hour it goes to sleep. I calculate the number of seconds until the top of the hour prior to each sleep cycle. So, my approach allows you to use a variable number of seconds for sleep.
Using time literals is cleaner - but there is less flexibility.
Chip
2 Likes
Hey, I think those are called chrono-literals and the docs are here.
From the docs, the available units are:
Literal | Unit |
---|---|
us | microseconds |
ms | milliseconds |
s | seconds |
min | minutes |
h | hours |
2 Likes