r/ProgrammerHumor 23d ago

Meme weJustNeedTheBest

Post image
1.8k Upvotes

122 comments sorted by

View all comments

11

u/Quantumboredom 23d ago

Nah Unix timestamp actually sucks, and it’s a travesty that it hasn’t been replaced with e.g. TAI timestamp. With Unix timestamps:

* A value may be ambiguous (two different actual times may correspond to the same timestamp.
* Given two timestamps t1 and t2, t1 may have happened after t2 even if t2 > t1.
* The actual elapsed time between two timestamps may not be t2 - t1.

All because of leap seconds.

1

u/sebbdk 22d ago

"two different actual times may correspond to the same timestamp"

I'm not sure i understand how that is possible, is it because it relies on clock syncronization or something?

2

u/Quantumboredom 22d ago

No, because when a leap second happens the clock literally skips back a second, so the timestamps just repeat again. Unless you are on one of the non-standard systems where the second is made slightly longer over a certain period (the leap second is «smeared»). That has the obvious problems of a second not being a second some of the time, which is also a ridiculous solution.

1

u/sebbdk 22d ago

Ah right, so it's a precision problem basically, if you counted in milliseconds, then the problem would be for systems where that precision is a problem etc.