Conversation

Charlotte lotteheartplural/Cinny cinny_heart_plural thetadelta ursaminor treblesand

how is unix time defined

43% number of seconds since january 1st 1970 at midnight utc
32% a, but with leap seconds removed
5% number of days since january 1st 1970 * 86,400 + number of seconds since midnight, both utc
18% wall seconds + wall minutes * 60 + wall hours * 3600 + day in the calendar year * 86400 + (year - 1970 * 31536000) + (year - 1969)/4 * 86400 - (year - 1901)/100 * 86400 + (year - 1601)/400 * 86400
4
4
4

Follow-up: is unix time strictly monotonic, assuming it is driven by a monotonic clock source?

15% Yes
21% No
63% It ought to be nowadays
2
2
1

Follow up 2: is it possible to determine the exact duration between two unix time stamps assuming a perfectly accurate clock that is stationary in an inertial reference frame

28% Yes
71% No
0
2
1

@charlotte not sure I read that right; it’s the number of seconds since Epoch. There is no removing of leap seconds, as they are not added anywhere, not accounted for; a day is always 86.400 seconds.

So, if you do have leap seconds on your clock (this is normal), it will be out of sync with the second sized ticks since Epoch, hence why time libraries almost never return plain unix as only option.

1
0
0

@charlotte

I'm sure leap seconds are removed when calculating a local date+time from it.
Usually to then calculate a Representation of that local date+time as a string.

0
0
0
spoiler for all the questions
Show content

@evi unix timestamps are based on the tm struct monstrosity that is the fourth option, which includes leap seconds, but only on the day that they occur on. this also means that unix timestamps are neither strictly monotonic (the tm structs permits 61 seconds in a minute) nor monotonic (the tm struct permits 62 seconds in a minute also). the third one is a bit of a trick question but basically it’s possible to determine if the unix timestamp refers to a time some time before 6 months from now

1
1
1

missed a few parenthesis in the last one oops

0
1
0
re: spoiler for all the questions
Show content

@charlotte devil is always in the details; I usually only needed this for calculations (way) in the past and even then basically always had to look it up.

0
0
1

@charlotte are we counting fractional seconds or not

1
0
0

@TerrorBite based on the posix definition of the unix timestamp

0
0
0