February 20, 2008

Epoch Dates

Filed under: Main — admin @ 12:01 am

I don’t remember how many PCs I used where every file on the computer was dated January 1, 1980, and had a creation time between midnight and 8:00 AM that morning. There was a reason for this.

Early PCs did have an internal time clock. What they lacked was the ability to keep track of time while the computer was turned off. When the computer was on, the clock kept normal (more or less, often less) track of the time. But unless you set the date and time when the computer first started, the PC believed the time to be January 1, 1980, midnight.

Any old timers out there remember the Date and Time prompts that appeared whenever you started a PC? You can still see them today, even in Windows Vista. Start a Command prompt and type DATE to set the date, then TIME to set the time.

datetime1.png

Just press the Enter key at either prompt to keep the time current, but you’ll at least see what people in the 1980s did when they first turned on their PCs.

The solution to the time problem was to install battery-backed up time-keeping hardware, commonly called a clock card. Eventually that hardware became part of the PC’s motherboard, and today all personal computers (even the Mac) sport an internal lithium battery that maintains the clock (as well as other information).

So the date January 1, 1980 is know as the epoch. That’s the term that describes when computers first keep track of time. For Unix computers, the epoch starts at January 1, 1970.

Why an epoch? Because of math. Calculating time using human readable dates is obnoxiously painful. How many hours between 2/20 noon and 2/23 at 4:00 AM? See? The epoch, however, keeps track of time by counting the seconds starting at a specific point. That way it’s much easier to do a calculation on dates and times. For example, a Unix computer sees noon on February 20, 2008 as:

1203508800

4:00 AM on February 23, 2008 is:

1203739200

Therefore, to calculate the difference, the values are subtracted. Then the computer performs the math, so don’t wrack your brain. The result is 230400 seconds. Or 3840 minutes. Or 64 hours.

See? Wasn’t that easy?

Relevant Links. Unix Time Calculator: date to unix time and unix time to date. Wikipedia: Unix Epoch.

Trivia & Time Wasting Dept. Here’s an interesting article on the History of the Cell Phone.

Remember. Don’t miss the eclipse tonight!

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.


Powered by WordPress