Daylight savings and getmtime
wittempj at hotmail.com
wittempj at hotmail.com
Fri Jan 28 18:34:43 EST 2005
on my windows xp box os.path.getmtime gives back local time (I just
saved the file):
>>> os.path.getmtime('c:\\temp\\testset.py')
1106955016
>>> print time.mktime(time.localtime())
1106955034.0
You can try to figure out if DST is on by comparing time.localtime()
versus time.gmtime(). In the Western European Timezone there's one hour
difference in winter and two hours in summer.
>>> os.path.getmtime('c:\\temp\\testset.py')
1106954702
>>> g = time.mktime(time.gmtime())
>>> l = time.mktime(time.localtime())
>>> print g, l
1106951381.0 1106954987.0
>>> os.path.getmtime('c:\\temp\\testset.py')
1106955016
>>> print time.mktime(time.localtime())
1106955034.0
>>> print l - g
3606.0
>>>
More information about the Python-list
mailing list