Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

POSIX 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.



Actually, 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

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.


I 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/g...

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/c...


Doesn't it only pick C? Negative leap seconds make POSIX time skip a second.


POSIX 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)


One 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)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: