4 ms·
Wait, why would it be different?
by quasarj 2y ago
Wait, why would it be different?
- School-Cotton 2y agoBecause a day, that is the time between midnight UTC and midnight UTC, is not always exactly 86400 seconds, due to leap seconds. But Unix time always increases by exactly 86400.
- growse 2y agoUnix time is not monatomic. It sometimes goes backwards.
- zokier 2y agoStrictly speaking Unix time is monotonic, because it counts integer number of seconds and it does not go backwards, it only repeats during leap seconds.
- growse 2y agoThis feels like semantics. If a counter repeats a value, it's effectively gone backwards and by definition is not monatomic. A delta between two monatomic values should always be non-negative. This is not true for Unix time.
- wat10000 2y ago“Monotonic” means non-decreasing (or non-increasing if you’re going the other way). Values are allowed to repeat. The term you’re looking for is “strictly increasing.”
- growse 2y agoI guess this hinges on whether you think Unix time is an integer or a float. If you think it's just an integer, then yes, you can't get a negative delta. If, however, you think it's a float, then you can.
- LegionMammal978 2y agoPOSIX does define "the amount of time (in seconds and nanoseconds) since the Epoch", for the output of clock_gettime() with CLOCK_REALTIME [0]. That "amount of time" must be stopped or smeared or go backward in some way when it reaches a leap second. This isn't the 80s, we have functions that interact with Unix time at sub-second precision. [0] https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_getres.html https://pubs.opengroup.org/onlinepubs/9799919799/functions/c...