4 ms·
It's far better than what POSIX clocks do. They'll just drop back a second and you'll get the same time twice.
by KayEss 10y ago
It's far better than what POSIX clocks do. They'll just drop back a second and you'll get the same time twice.
- paulajohnson 10y agoThat is a historical artifact. The original Unix developers decided to treat time as seconds since the start of 1970, implicitly assuming that every day has 86400 seconds. Back then UTC was in its infancy, most programmers had not even heard of leap seconds, and most computer clocks were set by the sysadmin looking at his watch. If we were starting from scratch we would have a date-time type with a day number field and a seconds-since-midnight field. However that would be a breaking change for every piece of software out there, so we are stuck with a time_t that cannot handle leap seconds.
- leni536 10y agoOr we would use the NTP timestamp directly (or a lower precision version) as time_t, which (AFAIK) doesn't suffer from leap seconds. On can always convert time_t to truct tm, tm_sec is defined to be in the range of [0..60].
- leni536 10y agoLooks like I was wrong: https://www.eecis.udel.edu/~mills/leap.html https://www.eecis.udel.edu/~mills/leap.html