01. Shape

Why time starts in 1970

The usual explanation is close enough to be repeated and wrong about the part that actually explains it.

For a separate operational view of time, ownership and team activity, see Monitask's practical guide.

why-time-starts-in-1970.src
epoch.h #define EPOCH 1970
/* because sixtieths ran out */

November 1971Unix Programmer's Manual, First Edition

Ask why computers count time from the first of January 1970 and the usual answer is that somebody picked a round number near the beginning of Unix. That is close enough to be repeated and wrong about the part that explains it.

The first edition of the manual defines the system call that returns the time, and it does not return seconds since 1970. It returns sixtieths of a second since the start of 1971.

1971Arithmetic on the published definition

Two things about that are worth doing arithmetic on. The resolution is a sixtieth of a second, which is the mains frequency of the country the machine was in, and the counter is thirty-two bits.

Thirty-two bits, signed, at sixty ticks a second, is a little over two and a quarter years. The machine's clock would have run out during the ordinary working life of the machine, and it would have done so in 1973.

1973 and 1973Unix Programmer's Manual, Third and Fourth Editions

So the definition changed. The resolution went from sixtieths of a second to whole seconds, which multiplies the life of the same thirty-two bits by sixty, and the origin moved to the start of 1970.

The date moved because the resolution changed. It is not the case that somebody chose 1970 and then chose a resolution to suit it.

1971The counter in the manual

Worth being precise about what the manual actually specifies, because the arithmetic only works if the numbers are right. The call returns a count of sixtieths of a second, and it returns it in a pair of sixteen-bit words treated as one thirty-two bit quantity, because the machine had no wider register.

Sixty ticks a second is not arbitrary either. It is the frequency of the mains supply in the country the machine stood in, and deriving a clock from the mains was the cheapest accurate timebase available. Machines in fifty-hertz countries counted fiftieths.

So the resolution was set by the electricity supply, and the range was set by the register width, and neither had anything to do with what anyone wanted the time for.

1973What replacing it cost

Changing the definition was not free. Every stored timestamp became meaningless, every program that did arithmetic on the value had to be revisited, and there was no compatibility layer because the notion barely existed yet.

It was affordable because the installed base was a handful of machines inside one organisation. The same change today would be one of the largest coordination problems ever attempted, which is the whole difficulty with the 2038 boundary: the decision is easy and the deployment is not.

Sixtieths of a second, from 1971full after about two and a quarter yearsWhole seconds, from 1970the same thirty-two bits, reaching 2038197119731970 epoch2038the epoch moved because the resolution changed, not the other way round
FigureThe same thirty-two bits under two definitions. At sixty ticks a second the counter is exhausted before the machine is; at one tick a second it reaches 2038.

1901 and 2038Two boundaries, not one

A signed thirty-two bit count of seconds reaches about sixty-eight years in each direction from its origin. The forward boundary is the nineteenth of January 2038. The backward one falls in December 1901.

The second boundary is the one that catches people out, because software that handles dates of birth, historical records or geological figures runs into it without anything unusual happening. A system that will never see 2038 can still fail on a date in the eighteen-nineties, and it fails quietly, by wrapping.

present dayWhy the fix is not one fix

Widening the counter to sixty-four bits is straightforward and has largely been done. What has not been done is everything that stores a timestamp in a fixed-width field: file formats, database columns, network protocols with a defined layout, hardware clocks, and every device shipped with firmware nobody will update.

The counter is easy. The agreements about how it is written down are the difficulty, and they are distributed across every organisation that ever chose four bytes because four bytes was obviously enough.

present dayWhere the assumption still hides

Two habits keep the old width alive in new code. Timestamps get stored as a number of seconds because that is the shortest thing to write, and the type is chosen by whatever the surrounding schema already uses. Neither step involves anyone deciding that sixty-eight years is enough.

The check worth running is not a search for the type. It is a search for every place a time leaves the program: files written, rows inserted, messages sent. The counter inside is easy to widen, and the written-down forms are where the boundary actually sits.

present dayThe same definition, still in use

The change bought a range of about sixty-eight years either side of the origin, and the far end of that range is the nineteenth of January 2038. The problem that carries that date is not a new bug. It is the same counter, still running, with the same width it was given when the alternative was running out in 1973.

What the record does not settle

Why the origin landed on 1970 rather than 1972 or the start of the project is not documented in the manuals. Accounts by the people involved describe it as a convenient round date once the pressure was off, and those accounts were given long afterwards, which is a specific kind of evidence and is not the same as a document written at the time.

We have not found a contemporaneous source stating the reason, and several confident explanations in circulation cite none.

In short

  1. The first Unix counted sixtieths of a second from the start of 1971.
  2. Thirty-two bits at sixty ticks a second is a little over two years.
  3. The counter would have overflowed in 1973, during the machine's working life.
  4. Moving to whole seconds multiplied the range by sixty; the origin moved with it.
  5. The date changed because the resolution changed, not the other way round.
  6. 2038 is that same counter, with the width it was given to escape 1973.

also in Shape

Next.

further context

For a primary or institutional reference, see the POSIX.1-2024 specification.

Every claim here carries the source it came from.

The source and its year sit beside the sentence they support. A secondary account is marked as one, and where the record is unclear the entry says so rather than choosing the better story.