FYI.

This story is over 5 years old.

Tech

Happy 1.5 Billion Unix Seconds

46 years ago, Unix time was born.
Image: pexels

On Jan. 1, 1970, Unix time was born. It didn't actually exist on that day; the Unix operating system only kind of/sort of existed then anyhow. But when the first edition of the Unix manual was released in 1971, it was thus declared that the beginning of Unix time—the Unix epoch, correctly—hath began on New Year's Day, 1970.

Maybe you've heard of the Unix epoch. Simply, it's the reference date that Unix-based computers use to tell time. It is just a count of the number of seconds that have elapsed since the beginning of the epoch. If you're running a Unix or Unix-like machine, you can get this count in its raw form by entering "date +%s" at the command line/terminal. ("Date" by itself will just give you the boring old date-date.) As of this writing, we're at 1,451,688,846 seconds.

Advertisement

And now 1,451,689,116 seconds. We're getting close.

It's a simple system. Every day a new 86,400 seconds turn over. The Unix time system is agnostic about things like the day of the week, the month, the hour, or really any of the trappings of human timekeeping. The Unix clock is agnostic about Earth's orbit around the Sun, and Earth's rotation about its axis. It's just a counter.

The downside is that Unix time doesn't account for leap seconds, which are the consequence of Earth's rotation not being quite on the money, e.g. not taking exactly 86,400 seconds to make one full spin. It might take an extra few milliseconds here and there because it's a great big-ass planet and doesn't care much about our timekeeping methods.

Leap seconds are slipped into Unix time only very rarely. The clock might tick only once for two seconds, or it might not tick at all for a single second. Nothing is ever added or subtracted from it, which is a system that keeps a lot of stuff from breaking.

Speaking of breaking, Unix time runs into a problem at 03:14:07 UTC on 19 January 2038. The 2038 epochalypse will occur when the Unix time counter overflows the limits of the 32-bit integer data type (at 2,147,483,647 seconds). Time will just rollover to 0 and start again.

Upgrading the epoch system from the 32-bit formats to a 64-bit format won't be easy, especially given how many embedded ("Internet of Things") devices are expected to be around by then. Sneaking an unupgraded date format through in the guts of a smart-dishwasher is a whole lot easier to imagine than an iPad or laptop. But we also don't have much of a choice.