<?xml version="1.0" encoding="iso-8859-1"?> 
<rdf:RDF
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:dc="http://purl.org/dc/elements/1.1/" 
	xmlns:dcterms="http://purl.org/dc/terms/" 
	xmlns:admin="http://webns.net/mvcb/"
	xmlns:thr="http://purl.org/rss/1.0/modules/threading/"
	xmlns:pb="http://www.ideaspace.net/users/wkearney/schema/postback/" 
	xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" 
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:mt="http://movabletype.org/"
	xmlns:foaf="http://xmlns.com/foaf/0.1/" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:html="http://www.w3.org/TR/REC-html40/"
	xmlns="http://purl.org/rss/1.0/"
> 

<rdf:Description rdf:about="http://www.ideaspace.net/users/wkearney/archives/entries/000526.html"> 
	<title>Time is more relative than you think</title>
	<link>http://www.ideaspace.net/users/wkearney/archives/entries/000526.html</link>
	<description>Raymond Chen gives a little insight in managing daylight savings time in his article Why Daylight Savings Time is nonintuitive....</description> 

	<dc:creator>wkearney</dc:creator> 
	<dc:date>2003-11-19T08:30:29-05:00</dc:date> 
	<dc:identifier>http://www.ideaspace.net/users/wkearney/archives/entries/000526.html</dc:identifier>
	<dc:language>en-us</dc:language>

	 
	<dc:subject>Geek</dc:subject>

	

	

	
	
	
	<dcterms:abstract>Raymond Chen gives a little insight in managing daylight savings time in his article Why Daylight Savings Time is nonintuitive....</dcterms:abstract> 
	<dcterms:created>2003-11-19T08:30:29-05:00</dcterms:created> 
	<dcterms:isPartOf rdf:resource="http://www.ideaspace.net/users/wkearney/" /> 

	<mt:body><![CDATA[<p>Raymond Chen gives a little insight in managing daylight savings time in his article <a title="CommentView" href="http://blogs.gotdotnet.com/raymondc/commentview.aspx/0e41ef9c-fa0b-4d09-a942-06e3d1a86961">Why Daylight Savings Time is nonintuitive</a>.</p>

<p>Israel and other countries shift their use of DST based on yearly government decisions?  </p>

<p>Oy (pun intended).</p>]]></mt:body>
	<mt:excerpt>Raymond Chen gives a little insight in managing daylight savings time in his article Why Daylight Savings Time is nonintuitive....</mt:excerpt> 
	<mt:more><![CDATA[<p>So let's get this straight, if you have a timestamp from 11/1/2003 at 12:00 local time and you convert it to UTC.  In November (non-DST for the Northern Hemisphere) that's a +02:00 offset.  This would make the time 10:00 GMT.  So if you stored it as 10:00 am you could convert it back again.  Sounds fine right?  <i>Wrong</i>.</p>

<p>Let's say you have a timestamp that's <i>during</i> the DST offset.  You have to take that offset into account when converting the time.  <b>Even if you're not current using an offset.</b></p>

<p>That means that while in November using a formula of <em>GMT_time = (localtime - localoffset)</em where <em>localoffset = +02:00</em> will <b>not</b> work in July unless you calculate what the <em>localoffset</em> value is supposed to be <b>on that date in July</b>.  Thus the formula becomes a little more complex.  <em>GMT_Time = (localtime + getOffset(localdate))</em>.  The function <em>getOffset()</em> would have to peform the calculation based on the matching <em>localdate</em> value corresponding to the <em>localtime</em>.</p>

<p>Trouble is there's no programmatic way to reliably convert that back into the localtime on that localdate unless you know the offset for <i>precisely </i>that period of time.  If the region uses a formula, as the US does, it's reasonably simple.  But if the region takes an 'optional' stance on it's handling you're in for a real set of headaches.</p>

<p>If you're wondering why anyone should care, think of a scenario.  Here's one, you come to work one morning on time at 8:30 am localtime.  If you're in Washington, DC during July this happens to be four hours off GMT.  This is because DC is five hours behind GMT and is using a DST offset of one hour.  That means you got to work at 4:30 GMT.  Fast forward to the winter and that's 3:30 GMT.  Let's say your database stores the time as GMT.  This means the database would have something like "7/1/2003T04:30:00Z" during the summer and "11/1/2003T03:30:00Z" during the winter.  If you were doing personnel reports you'd have to take those shifts into account when doing calculations.  If, for example, you wanted to determine tardiness your offset becomes crucial.  Run that report using the wrong offset and it makes you look either habitually late in the summer or some sort of early-bird-gets-the-worm freak all winter.</p>

<p>Thus you'd have to make sure that your calculations always took the relative offset into account.  Either that or you'd have to store using local times.  Trouble is, if you want to do any calculations across multiple zones you'd need to make sure you stored the <em>correct</em> local offset along with it.  In the previous example this would mean storing "7/1/2003T08:30-04:00" and "11/1/2003T08:30-05:00".  Then you'd just have to make sure <b>not</b> to use the offset when doing calculations against it unless you transposed them back to GMT.  Sound good so far, right?  Wrong again.  If you had timestamps stored from different zones you'd need to make sure you properly tracked them as such.  Thus your counterpart arriving for work in San Francisco would calculate as "7/1/2003T08:30:00-07:00" and likewise use an "-08:00" offset in November.   The key here is you cannot depend on using the "overall" offset.  Here in DC that means you can't just slap "-05:00" on timestamps during DST.</p>

<p>Frankly, I continue to be confounded about timestamps.  It all sounds so simple but given the plethora of timezones and regional and seasonal offsets it becomes more complex than you might think.</p>

<p>Futher reading:<blockquote><a href="http://www.worldtimezone.com/daylight.htm">WorldlTime</a>, <a href="http://www.w3.org/TR/NOTE-datetime">W3CDTF</a> and <a title="in PDF format" href="http://lists.ebxml.org/archives/ebxml-core/200104/pdf00005.pdf">ISO-8601</a> specs</blockquote></p>]]></mt:more>
	<mt:keywords></mt:keywords> 
	<mt:entryID>526</mt:entryID>

	<mt:entryPrev>525</mt:entryPrev>
	<mt:entryNext>527</mt:entryNext>

	<html:link rel="prev" type="application/xml" href="http://www.ideaspace.net/users/wkearney/archives/entries/000525.html.xml" title="What kind of social software are you?" />
	<html:link rel="next" type="application/xml" href="http://www.ideaspace.net/users/wkearney/archives/entries/000527.html.xml" title="SETI space-borne virus?" />
	
	<mt:author>wkearney</mt:author> 
	<mt:authorNickname>Bill Kearney</mt:authorNickname> 
	<mt:authorEmail>wkearney@ideaspace.net</mt:authorEmail>
	<mt:authorURL rdf:resource="http://www.ideaspace.net/users/wkearney" /> 
	
	<foaf:name>wkearney</foaf:name> 
	<foaf:mbox rdf:resource="mailto:wkearney@ideaspace.net" /> 
	<foaf:nick>Bill Kearney</foaf:nick> 
	<foaf:homepage rdf:resource="http://www.ideaspace.net/users/wkearney" />
	
	<rdfs:seeAlso rdf:resource="http://www.ideaspace.net/users/wkearney/xml/index.rdf" />
	<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.64" /> 
</rdf:Description>
</rdf:RDF>