3 ms·
Unix does the sensible thing and records timestamps in seconds since the epoch. The epoch is always 1970 January 1 00:00:00 UTC. Timestamps in logs and sent ov
by zrm 6y ago
Unix does the sensible thing and records timestamps in seconds since the epoch. The epoch is always 1970 January 1 00:00:00 UTC. Timestamps in logs and sent over the wire in that format then don't have a timezone encoded because the "timezone" only gets applied when converting to a format that encodes time of day. When used as a wire format this also allows every device to display the time in its own timezone.
- zokier 6y ago> Unix does the sensible thing and records timestamps in seconds since the epoch. If only, but unfortunately that's not how UNIX time works. Instead its more like number of days since epoch * 86400 + seconds since midnight. Which is 27 seconds different than simple seconds since epoch count. This is why I would advise against using UNIX timestamps for anything critical because they are fundamentally ambiguous
- zrm 6y ago> Instead its more like number of days since epoch * 86400 + seconds since midnight. Which is 27 seconds different than simple seconds since epoch count. Yeah, the people who decided to do that were Wrong. Fortunately it only really matters during leap seconds, and nothing stops you from doing it the right way and having your timestamps in actual seconds since epoch and then converting to "Unix time" or anything else you need. See e.g. libtai: https://cr.yp.to/libtai.html https://cr.yp.to/libtai.html