Difference between revisions of "Time Zones, Python and the Nokia N70"

From rukapedia
Jump to: navigation, search
 
Line 3: Line 3:
 
==Time at GMT, Daylight Savings Time OFF==
 
==Time at GMT, Daylight Savings Time OFF==
  
At '''21:00 GMT''', I set the current city to ''London, United Kingdom'', but left Daylight Savings Time ''off''.  The phone shows '''20:00''' --
+
At '''20:00 GMT''', I set the current city to ''London, United Kingdom'', but left Daylight Savings Time ''off''.  The phone shows '''20:00''' --
  
 
[[Image:Clock1.jpg]]
 
[[Image:Clock1.jpg]]
Line 15: Line 15:
 
(2006, 7, 14, 20, 0, 0, 4, 195, -1)
 
(2006, 7, 14, 20, 0, 0, 4, 195, -1)
 
</pre>
 
</pre>
 +
 +
'''Result: GMT is correct, local time one hour early.'''
  
 
==Time at GMT, Daylight Savings Time ON==
 
==Time at GMT, Daylight Savings Time ON==
  
At '''21:09 GMT''', I set the current city to ''London, United Kingdom'', and turned Daylight Savings Time ''on''.  The phone shows '''21:09''' --
+
At '''20:09 GMT''', I set the current city to ''London, United Kingdom'', and turned Daylight Savings Time ''on''.  The phone shows '''21:09''' --
  
 
[[Image:Clock2.jpg]]
 
[[Image:Clock2.jpg]]
Line 30: Line 32:
 
(2006, 7, 14, 21, 9, 0, 4, 195, -1)
 
(2006, 7, 14, 21, 9, 0, 4, 195, -1)
 
</pre>
 
</pre>
 +
 +
'''Result: GMT is one hour ahead, local time is correct'''
  
 
==Time at GMT-4, Daylight Savings Time OFF==
 
==Time at GMT-4, Daylight Savings Time OFF==
  
At '''21:12 GMT''', I set the current city to ''Halifax, Nova Scotia'' (GMT-4), but left Daylight Savings Time ''off''.  The phone shows '''16:12''' --
+
At '''20:12 GMT''', I set the current city to ''Halifax, Nova Scotia'' (GMT-4), but left Daylight Savings Time ''off''.  The phone shows '''16:12''' --
  
 
[[Image:Clock3.jpg]]
 
[[Image:Clock3.jpg]]
Line 45: Line 49:
 
(2006, 7, 14, 20, 12, 0, 4, 195, -1)
 
(2006, 7, 14, 20, 12, 0, 4, 195, -1)
 
</pre>
 
</pre>
 +
 +
'''Result: GMT is correct, local time one hour early.'''
 +
 +
==Time at GMT-4, Daylight Savings Time ON==
 +
 +
At '''20:18 GMT''', I set the current city to ''Halifax, Nova Scotia'' (GMT-4), and turned Daylight Savings Time ''on''.  The phone shows '''17:18''' --
 +
 +
[[Image:Clock4.jpg]]
 +
 +
And Python returns '''17:18''' for '''localtime()''' and '''21:18''' for '''gmtime()''':
 +
 +
<pre>
 +
>>> time.localtime()
 +
(2006, 7, 14, 17, 18, 0, 4, 195, -1)
 +
>>> time.gmtime()
 +
(2006, 7, 14, 21, 18, 0, 4, 195, -1)
 +
</pre>
 +
 +
'''Result: GMT is one hour ahead, local time is correct'''

Revision as of 17:26, 14 July 2006

Since I started hacking my Nokia N70 mobile phone, I've been confused by how it handles (or doesn't handle) time zones and daylight savings time. This page is an attempt to document what it actually supports and when.

Time at GMT, Daylight Savings Time OFF

At 20:00 GMT, I set the current city to London, United Kingdom, but left Daylight Savings Time off. The phone shows 20:00 --

Clock1.jpg

And Python returns 20:00 for both gmtime() and localtime():

>>> time.localtime()
(2006, 7, 14, 20, 0, 0, 4, 195, -1)
>>> time.gmtime()
(2006, 7, 14, 20, 0, 0, 4, 195, -1)

Result: GMT is correct, local time one hour early.

Time at GMT, Daylight Savings Time ON

At 20:09 GMT, I set the current city to London, United Kingdom, and turned Daylight Savings Time on. The phone shows 21:09 --

Clock2.jpg

And Python returns 21:09 for both gmtime() and localtime():

>>> time.localtime()
(2006, 7, 14, 21, 9, 0, 4, 195, -1)
>>> time.gmtime()
(2006, 7, 14, 21, 9, 0, 4, 195, -1)

Result: GMT is one hour ahead, local time is correct

Time at GMT-4, Daylight Savings Time OFF

At 20:12 GMT, I set the current city to Halifax, Nova Scotia (GMT-4), but left Daylight Savings Time off. The phone shows 16:12 --

Clock3.jpg

And Python returns 16:12 for localtime() and 20:12 for gmtime():

>>> time.localtime()
(2006, 7, 14, 16, 12, 0, 4, 195, -1)
>>> time.gmtime()
(2006, 7, 14, 20, 12, 0, 4, 195, -1)

Result: GMT is correct, local time one hour early.

Time at GMT-4, Daylight Savings Time ON

At 20:18 GMT, I set the current city to Halifax, Nova Scotia (GMT-4), and turned Daylight Savings Time on. The phone shows 17:18 --

Clock4.jpg

And Python returns 17:18 for localtime() and 21:18 for gmtime():

>>> time.localtime()
(2006, 7, 14, 17, 18, 0, 4, 195, -1)
>>> time.gmtime()
(2006, 7, 14, 21, 18, 0, 4, 195, -1)

Result: GMT is one hour ahead, local time is correct