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.
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.