3 ms·
And I guess POSIX tries to pick all three, at least most of the time. It follows UTC mostly, except during leap seconds when it changes the duration of a POSIX-
by bxparks 2y ago
And I guess POSIX tries to pick all three, at least most of the time. It follows UTC mostly, except during leap seconds when it changes the duration of a POSIX-second to be 2 SI-seconds (positive leap second) or 0 SI-seconds (negative leap second).
- amiga386 2y agoPOSIX time_t picks A and C. 99.999998% of time_t ticks from 1970 until now have been 1 second long. 27 have been 2 seconds long. Therefore B ("each smaller time unit is of a fixed physical duration") is the variant.
- bloppe 2y agoActually, this sort-of describes "smeared UTC", which is used by some computer systems such as Google's NTP servers: https://developers.google.com/time/smear https://developers.google.com/time/smear POSIX time does not generally work that way. It may seem that way for 1-second resolution timestamps, but at higher resolutions (say millisecond resolution), the clock does not completely stop. It keeps going, jumps backward 1 second, then continues.
- amiga386 2y agoI think you're talking about struct timespec, I'm talking about time_t. I don't think "POSIX time" specifies behavior during leap-seconds for the functions that return timespecs (gettimeofday() [0] and clock_gettime(CLOCK_REALTIME) [1]), so any behaviour would be valid - including smearing or repeating nanoseconds? [0] https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/g... [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/c...
- RedNifre 2y agoDoesn't it only pick C? Negative leap seconds make POSIX time skip a second.
- amiga386 2y agoPOSIX time_t still ticked, but the interval between the ticks was 0s, rather than 1s or 2s. It preserves A (exactly 86400 ticks per calendar day) and C (remains in alignment with UTC) by abandoning B (each tick has a fixed duration)
- brewmarche 2y agoOne could also make ticks on such a day last 86400/86401 or 86400/86399 seconds, keeping the tick duration fixed but only for a given day (a relaxed version of B)