Re: Daylight savings time problem
I'm sorry, but could you be more specific? How exactly should I use UTC? -- Fabio Durieux Lopes - Salsa - Original Message From: D'Arcy J.M. Cain <[EMAIL PROTECTED]> To: Fabio Durieux Lopes <[EMAIL PROTECTED]> Cc: [email protected] Sent: Wednesday, March 26, 2008 4:49:57 PM Subject: Re: Daylight savings time problem On Wed, 26 Mar 2008 19:37:16 - "Fabio Durieux Lopes" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> | 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. Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- http://mail.python.org/mailman/listinfo/python-list
Re: Daylight savings time problem
Yeah, I guess it would, but it doesn't feel like the "right" way to do it. Isn't there a way I can set tm_isdst to "-1"? Or at least slice the time_struct and then add another element to its end when passing it to mktime? Thanks for all your help! --- "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Wed, 26 Mar 2008 13:23:23 -0700 (PDT) > Salsa <[EMAIL PROTECTED]> wrote: > >I'm sorry, but could you be more specific? How > exactly should I use UTC? > > Pardon me. I misread. I thought that you were > creating the files. I > see that you are reading files created by someone > else. > > Still, would "os.environ['TZ'] = 'UTC'" fix the > issue? > > -- > D'Arcy J.M. Cain <[EMAIL PROTECTED]> | > 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. > -- Fabio Durieux Lopes - Salsa Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- http://mail.python.org/mailman/listinfo/python-list
