Technical Q&A

OPS 23 - Timely Issues - 1904 (17-May-1999)


Q: The global variable Time contains the number of seconds since midnight, Jan. 1, 1904. Why was the year 1904 chosen?

A: The ability to go back in time is one consideration. You would not want to start the clock from, say, 1984. You also want to go ahead in time a good amount, of course. So, the clock start date needs to put our current date somewhere in the middle of the clock's range.

So what is the clock's range? Since the clock chip has a four-byte counter which is incremented each second, they had 4,294,967,295 seconds to work with, or approximately 136 years. This would make the Macintosh clock run out in 1904+136 = 2040. The maximum value, $FFFFFFFF, corresponds to 6:28:15 a.m., February 6, 2040.

Given the possible range of years/leap years/nonleap years (every fourth year, but not if at the end of a century, except at the end of every fourth century, which is a leap year) and the date when the clock will run out (2040) - the "leap year code" in the Macintosh only has to deal with the rule "every fourth year is a leap year" because none of the possible Macintosh dates violate that rule! Remember, 2000 is evenly divisible by 400, so it IS a leap year. 1900 is not. If they started at 1900, they would have to use a different algorithm that accounts for "non-leap year" leap years. Some other clocks start on 1901.

Why did they start on 12:00:00, January 1, 1904? Well, it probably has to do with 1904 being the first leap year after a "non-leap year" leap year (1900). So, the year was chosen for mechanical (four-byte limit on number of seconds) and pragmatic (you only want to use one algorithm to figure out the date, et al) considerations.

So, back to the future...

Further Reference:

Chapter 4, "Worldwide Guide to System Software" on the Developer CD Series

-- Mark Cookson
Worldwide Developer Technical Support

Technical Q&As | Contents
Previous Question | Next Question

To contact us, please use the Contact Us page.