this post was submitted on 17 Apr 2024
1452 points (98.6% liked)
Programmer Humor
19623 readers
25 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Almost all computers count time as seconds from the epoch (midnight 1/1/1970). That then gets converted into a readable time, which may go through UTC to be converted first, but that's not how it's storing it.
You're referring to UNIX time. And you're correct.
It's a count of how many seconds from midnight, January first, 1970, UTC.
Local computers update that time, still in UTC, from time servers, usually over NTP, then translate that time reading from UNIX time in UTC, to a human readable format in the local time zone.
All computers are still keeping track of time from Epoch in UTC.
Unix time is far less universal in computing than you might hope. A few exceptions I'm aware of:
Converting between time formats is a common source of bugs and each one will overflow in different ways. A time value might overflow in the year 2036, 2038, 2070, 2100, 2156, or 9999.
Also, Unix time is often managed with a separate nanoseconds component for increased resolution. Like in C
struct timespec
, modern *nix filesystems like ext4/xfs/btrfs/zfs, etc.