this post was submitted on 03 Apr 2024
1103 points (96.2% liked)

Programmer Humor

22395 readers
2989 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] arc@lemm.ee 4 points 1 year ago (1 children)

I didn't say Unix time, I said UTC. And no it won't report negative time, not unless somehow the system clock was modified while it was running..

[–] uis@lemm.ee 1 points 1 year ago* (last edited 1 year ago) (1 children)

not unless somehow the system clock was modified while it was running..

Which is how most systems handle leap seconds.

[–] arc@lemm.ee 0 points 1 year ago* (last edited 1 year ago) (1 children)

Leap seconds still make time go forwards, not backwards. NTP clients would also resolve small time discrepancies while still advancing forwards prior to the next time sync.

[–] uis@lemm.ee 1 points 1 year ago* (last edited 1 year ago) (1 children)

Leap seconds can make time go both ways, but adding them makes time stop/go back because 24:00:00 cannot be represented as 1/86400 part of day N instead of day N+1 on major OSes. And they were only added so far.

[–] arc@lemm.ee 1 points 1 year ago* (last edited 1 year ago) (1 children)

It doesn't work like that. UTC goes forward always. Leap seconds are scheduled and known in advance. NTP time services will just smear time advancement a little to account for an additional second. Time never has to go backwards. This is how Google does it.

[–] uis@lemm.ee 1 points 1 year ago

This is how Google does it in their datacenters, but not major OSes by default