What is Unix Time? Pub Trivia for Geeks


What is Unix Time?

Did you hear about the time that Twitter’s app crashed because it thought it was 2015? No seriously, it’s not some geeky joke, it actually happened on 29 December 2014. The Guardian couldn’t wait to tell the world that Twitter can’t read a wristwatch. But how did it happen? It was all down to erroneous programming in Unix time.

Take a seat. This might blow your mind.

Make way for Unix, Pope Gregory

It’s easy to take the Gregorian calendar for granted as being the only way of measuring time. It’s the most widely used system in the West, but many cultures around the world still use their traditional calendars to mark important religious days or festivals. Take the Hebrew and Buddhist calendars, for example, they use completely different date systems.

The field of finance has its own meter too — the International Organisation for Standardisation (ISO) Week System (aka ISO 8601). It comprises 52 weeks of 7 days, each week starting on a Monday. According to ISO, the last few days of 2019 are technically part of Week 1, 2020. Does that mean the finance industry celebrates New Year on 30 December, 31 December or on both dates? Imagine the two-day long party at the Bank of England.

What’s the deal with computers, then? Well, the rumours are true. Programmers really do live in a parallel universe. Forget everything you thought you knew about telling the time for a moment and enter the world of Unix time, also known as POSIX time or Epoch time.

It all began on 1 January 1970

What is Unix time?

Computers don’t count days, months or years, etc. Instead, they work on the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds. Why that date? Because it was convenient for early Unix engineers to work with.

To find out what the Epoch time is now, visit www.epochconverter.com. You know you’re curious.

Software developers have a few hoops to jump through when it comes to programming time-related things in apps and services. They don’t only have to specify date formats, such as 01/07/20 vs 1st July 2020 or 07/01/20, but also which calendar to use. Then they grab the Unix time (number of seconds since 1 January 1970) and display it in the required format using a date string. So, something like %d %B %Y would convert to 1 July 2020. Type in the wrong string and things can go very wrong, can’t they Twitter? Yes, THAT’S how erroneous programming in Unix time caused the world’s favourite microblogging platform a moment of monumental embarrassment. They accidentally used %G for the year instead of %Y and arrived at the ISO 86-1 week number. Oops. Unix will tick another billion tocks before Twitter lives that one down.

Don’t know your %Y from your %G? Give us a shout. We’ll get your IT system running like clockwork.