53 lines
1.3 KiB
Plaintext
53 lines
1.3 KiB
Plaintext
From: scrompton at quantisci.co.uk (Stephen Crompton)
|
|
Date: Thu, 15 Apr 1999 16:24:38 +0100
|
|
Subject: timezone stuff driving me bonkers!!!
|
|
Message-ID: <371604B6.C6267011@quantisci.co.uk>
|
|
Content-Length: 1040
|
|
X-UID: 1429
|
|
|
|
Pretty obvious from the header I guess.
|
|
|
|
I want to convert from a UTC tuple to the time since the epoch. As far
|
|
as I can tell this should definitely be timezone, DST, etc. independent.
|
|
However, there is a notable absence of this functionality in the time
|
|
module (presumably due to C library absences ?)
|
|
|
|
Anyway, I keep seeing mention that
|
|
|
|
time.mktime(tpl)-time.timezone - (1)
|
|
|
|
should work if the timezone is working correctly,
|
|
|
|
but why isn't it
|
|
|
|
time.mktime(tpl)-time.altzone ? -
|
|
(2)
|
|
|
|
I merely observe that
|
|
|
|
time.mktime(time.localtime(time.time()))
|
|
|
|
is (near enough) time.time()
|
|
|
|
So, surely in the above example (1), tpl would have to be in localtime
|
|
for the above to make sense. Writing as somebody who is currently
|
|
observing DST (UK), this is clearly the case as time.timezone = 0.
|
|
|
|
So, entering a UTC tuple in (1) would not give me the equivalent of
|
|
time.time() !! (though (2) would)
|
|
|
|
Somebody must be able to point out a flaw in my logic ?
|
|
|
|
Cheers,
|
|
|
|
Steve.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|