os.path.getmtime on winXP

Bengt Richter bokr at oz.net
Tue Nov 8 06:14:21 EST 2005


On Tue, 08 Nov 2005 10:49:56 +0100, =?ISO-8859-1?Q?Jorg_R=F8dsj=F8?= <jorg at neoplex.org> wrote:

>Bengt Richter wrote:
>> How did you format the number you got from os.path.getmtime?
>
>I'm not doing any formating at all. I am just looking at the numbers of 
>seconds since epoch. Which is what makes it so strange.
>
>> You might want to try some of the above.
>
>I'll do that. At the moment I'm looking at the difference between 
>localtime and gmtime to see if my computer is in dst. If it is not, I 
>just add 3600 seconds to the result from os.path.getmtime -- which then 
>should give consistent results.
the time module should know how to do that for you, unless something is fubar.

see time.timz
    import time
    help(time)

>
>> If you actually created/modified files just before and after the DST change
>> and saw an extra hour difference instead of the time between the two actions,
>> then maybe I'd look into whether the OS has some perverse option to use local DST
>> time to record in the file stat info, but that's hard to believe. More likely someone
>> is messing with with raw file time setting, like touch. Don't have it handy to see
>> what DST assumptions it makes if any.
>
>The files I am testing with have not been modified for a long time. 
>Windows reports the modified date as being the same, no matter what I do 
>    (both through the gui, and through win32file). And they all show the 
>same strange 3600 sec difference with/without dst when I call getmtime 
>on them.
By 'getmtime' you mean os.path.getmtime(fer_shure_or_absolute_path_to_file) right?
Doesn't that get you an integer number of seconds? What GUI or win32file is showing you
that integer so you see a 3600 sec difference? Or how are you seeing it?

Could you paste an example of this difference from an example on your screen?
I don't think I am understanding ;-) ... urk, it's late ;-/

Regards,
Bengt Richter



More information about the Python-list mailing list