Daylight savings time problem
D'Arcy J.M. Cain
darcy at druid.net
Wed Mar 26 15:49:57 EDT 2008
On Wed, 26 Mar 2008 19:37:16 -0000
"Fabio Durieux Lopes" <durieux_br at yahoo.com.br> wrote:
> I'm trying to execute some operations based on a file's time. The
> file's time is actually the file's name (e.g. FILE1_20080326170558).
> So I do this:
> fileTimeInSecs = time.mktime(time.strptime(timeString,
> "%Y%m%d%H%M"))
>
> timeString contains the date part of the file's name. Function
> strptime returns a time_struct, but my problem is that tm_isdst is
> set to 0, and when we enter daylight savings time the file's time is
> off by 1 hour. This time_struct is also read only so I can't change
> tm_isdst to -1.
>
> Anyone knows how to fix it?
Use UTC.
--
D'Arcy J.M. Cain <darcy at druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
More information about the Python-list
mailing list