Andrew
Andrew

Reputation: 121

When was Unix epoch time revised from 1971 to current 1970 value?

According to the first edition Unix Programmer's Manual, Unix time is defined as "the time since 00:00:00, January 1, 1971, measured in sixtieths of a second"

When did this change to its current value of midnight (UTC), January 1, 1970?

Upvotes: 8

Views: 2407

Answers (1)

mark4o
mark4o

Reputation: 60933

In First Edition Unix (November 1971), the manual page for the time system call stated that it returned "the time since 00:00:00, Jan. 1, 1971, measured in sixtieths of a second". This was a 32-bit value, so even treated as unsigned it could only track about 2.26 years beyond this date. However the manual page and source code comments describe the system call as "get time of year", the year could not be set, and the date command and ctime() function (used to format the date and time) did not format a year or even work correctly with time values larger than 1 year, so it was probably expected that the date would be manually reset each year and the year 1971 in the manual page was of little significance. Well, except for the little problem that 1972 has an extra day; regarding that, a note was later added to the bugs section: "The routine must be reassembled for leap year". Nice.

In 1972 the manual page for the time system call was changed to state that it returned the time since "00:00:00, Jan. 1, 1972", with the note: "The time is stored in 32 bits. This guarantees a crisis every 2.26 years."

In Fourth Edition Unix (November 1973) the time system call was changed to return "the time since 00:00:00 GMT, Jan. 1, 1970, measured in seconds". (The manual page is dated August 5, 1973, so that may have been when the changes were originally made.) This is essentially the current definition, except that the historic term GMT has been replaced by the more precise Coordinated Universal Time and clarifications have been made regarding leap seconds. On systems that return this as a signed 32-bit number, this will work until the year 2038. Fortunately many systems now use 64 bits for this value.

Upvotes: 10

Related Questions