syncClockTime :: TimeZone -> UTCTime -> Pico -> Pico
syncClockTime zone time secondTo = do
let (TimeOfDay hour minute secondFrom) = localTimeOfDay $ utcToLocalTime zone time
if secondTo > secondFrom then
secondTo - secondFrom
else
60 + secondTo - secondFrom
I have a couple of questions related to the above code
- is there a way to directly extract the seconds
secondFrom
from theUTCTime
without converting it to local time and without specifying a time zone? (if yes: how? if no: why?) - How to actually make the running thread/task to asynchronously sleep for the above found number of seconds?