{"id":30,"date":"2008-02-20T00:01:28","date_gmt":"2008-02-20T07:01:28","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/2008\/02\/20\/epoch-dates\/"},"modified":"2008-02-19T21:38:10","modified_gmt":"2008-02-20T04:38:10","slug":"epoch-dates","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=30","title":{"rendered":"Epoch Dates"},"content":{"rendered":"<p>I don&#8217;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.<\/p>\n<p>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.<\/p>\n<blockquote><p>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 <code>DATE<\/code> to set the date, then <code>TIME<\/code> to set the time.<\/p>\n<p><img src='http:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2008\/02\/datetime1.png' alt='datetime1.png' \/><\/p>\n<p>Just press the Enter key at either prompt to keep the time current, but you&#8217;ll at least see what people in the 1980s did when they first turned on their PCs.<\/p><\/blockquote>\n<p>The solution to the time problem was to install battery-backed up time-keeping hardware, commonly called a <em>clock card<\/em>. Eventually that hardware became part of the PC&#8217;s motherboard, and today all personal computers (even the Mac) sport an internal lithium battery that maintains the clock (as well as other information).<\/p>\n<p>So the date January 1, 1980 is know as the <em>epoch<\/em>. That&#8217;s the term that describes when computers first keep track of time. For Unix computers, the epoch starts at January 1, 1970.<\/p>\n<p>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&#8217;s much easier to do a calculation on dates and times. For example, a Unix computer sees noon on February 20, 2008 as:<\/p>\n<p><code>1203508800<\/code><\/p>\n<p>4:00 AM on February 23, 2008 is:<\/p>\n<p><code>1203739200<\/code><\/p>\n<p>Therefore, to calculate the difference, the values are subtracted. Then the computer performs the math, so don&#8217;t wrack your brain. The result is  <code>230400<\/code> seconds. Or <code>3840<\/code> minutes. Or <code>64<\/code> hours.<\/p>\n<p>See? Wasn&#8217;t that easy?<\/p>\n<p><strong>Relevant Links.<\/strong> Unix Time Calculator: <a href=\"http:\/\/www.csgnetwork.com\/time2unixdscalc.html\" target=\"news\">date to unix time<\/a> and <a href=\"http:\/\/www.csgnetwork.com\/unixds2timecalc.html\" target=\"news\">unix time to date<\/a>. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Unix_time\" target=\"news\">Wikipedia: Unix Epoch<\/a>.<\/p>\n<p><strong>Trivia &#038; Time Wasting Dept.<\/strong> Here&#8217;s an interesting article on the <a href=\"http:\/\/tech.msn.com\/products\/slideshow.aspx?cp-documentid=4864891\" target=\"news\">History of the Cell Phone<\/a>.<\/p>\n<p><strong>Remember.<\/strong> Don&#8217;t miss the <a href=\"http:\/\/science.nasa.gov\/headlines\/y2008\/13feb_lunareclipse.htm\" target=\"new\">eclipse<\/a> tonight!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=30"}],"version-history":[{"count":0,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/30\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}