Closed amano-kenji closed 11 months ago
On a correctly-configured system, getCurrentTime
will give the correct UTC time, except during a leap-second. Is that the problem?
I researched leap second, and it turns out that ntp either slows down the system clock or steps the system clock back by one second after leap second. Thus, leap second is already accounted for in the system clock.
So, software developers don't have to think about leap seconds as long as leap second is taken care of by ntpd.
getCurrentTime :: IO UTCTime
usessystemToUTCTime
which doesn't account for leap seconds.getSystemTime
doesn't seem to account for leap seconds.getPOSIXTime
doesn't account for leap seconds.posixSecondsToUTCTime
doesn't account for leap seconds.It seems to me that no chain of functions can produce a valid UTCTime.
The documentation says
UTC needs to account for leap seconds. Where are leap seconds accounted for? Is any haskell program using
time
library incapable of displaying local time or UTC time after accounting for leap seconds?