top | item 33660339

(no title)

LaputanMachine | 3 years ago

> we do hour offsets twice a year, so if an hour off is okay why is 1 second off not?

The actual Unix time does not change when the clocks are switched between daylight saving time and standard time. Only the time zone changes.

When a leap second occurs, the actual Unix time changes, which can lead to bugs, e.g. when a positive time difference comes back as negative. To prevent such issues, a monotonic clock can be used to measure time intervals.

discuss

order

ender341341|3 years ago

Edit: OK, just re-read some docs, looks like POSIX chose the worst of all options and decrements the timestamp experiencing the same second twice...

Wrong info from before edit: Unix time doesn't change either, it's the number of seconds since 00:00:00 UTC on 1 January 1970, though systems may or may not ignore that and set it to match the UTC time.

vlovich123|3 years ago

Yes. It does. Op is correct. A leap second specifically is an adjustment because “how many seconds since 1970” changes because the earth’s rotation isn’t constant speed. UTC tone definitely changes. If it didn’t then you wouldn’t hear anything about it and it would just be transparently folded into your time zone database.