Problems with the date of modification of files on the flash drive in windows

Aleksey alekseymv at gmail.com
Sat Jan 23 06:23:37 CET 2010


Hi All,

I write crossplatform program and have next problem under windows
(under linux is all OK) :

I'm trying to get the UTC modification date of files on the flash
drive under windows. In the flash card system is FAT. In the winter
time (2010 01 21) Date of modification:


    >>> op.getmtime('g:\\alex\\bag\\pybag.log')
    1263998652.0


In the summer time (2010 07 21) Date of the modification on the hour
(3600 sec) different from winter time:


   >>> op.getmtime('g:\\alex\\bag\\pybag.log')
   1263995052.0


Also time zone is "GMT" but real is "OMST" and localtime  is wrong. In
windows  "tm_isdst" is always "0".

For files on the HDD with NTFS modification time is right.

How I can get right GMT time for files in flash with FAT under
windows?


Winter for Windows
----------------------

>>> time.altzone
    -3600
    >>> time.daylight
    0
    >>> time.localtime()
    time.struct_time(tm_year=2010, tm_mon=1, tm_mday=21, tm_hour=3,
tm_min=32, tm_sec=42, tm_wday=3,
    tm_yday=21, tm_isdst=0)
    >>> time.gmtime()
    time.struct_time(tm_year=2010, tm_mon=1, tm_mday=21, tm_hour=3,
tm_min=32, tm_sec=48, tm_wday=3,
    tm_yday=21, tm_isdst=0)
    >>> time.tzname
    ('GMT', '')
    >>> time.timezone
    0

Summer for Windows
-----------------------------

    >>> time.altzone
    -3600
    >>> time.daylight
    0
    >>> time.localtime()
    time.struct_time(tm_year=2010, tm_mon=7, tm_mday=21, tm_hour=2,
tm_min=13, tm_sec=18, tm_wday=2,
    tm_yday=202, tm_isdst=0)
    >>> time.gmtime()
    time.struct_time(tm_year=2010, tm_mon=7, tm_mday=21, tm_hour=2,
tm_min=13, tm_sec=26, tm_wday=2,
    tm_yday=202, tm_isdst=0)
    >>> time.tzname
   ('GMT', '')
   >>> time.timezone
   0


>From Linux for summer:
---------------------------------

   >>> time.altzone
   -25200
   >>> time.daylight
   1
   >>> time.localtime()
   time.struct_time(tm_year=2010, tm_mon=7, tm_mday=23, tm_hour=12,
tm_min=7, tm_sec=24, tm_wday=4,
   tm_yday=204, tm_isdst=1)
   >>> time.gmtime()
   time.struct_time(tm_year=2010, tm_mon=7, tm_mday=23, tm_hour=5,
tm_min=7, tm_sec=36, tm_wday=4,
   tm_yday=204, tm_isdst=0)
   >>> time.timezone
   -21600
   >>> time.tzname
   ('OMST', 'OMSST')


>From Linux for winter:
------------------------------------

   >>> time.altzone
   -25200
   >>> time.daylight
   1
   >>> time.localtime()
   time.struct_time(tm_year=2010, tm_mon=1, tm_mday=23, tm_hour=11,
tm_min=8, tm_sec=26, tm_wday=5,
   tm_yday=23, tm_isdst=0)
   >>> time.gmtime()
   time.struct_time(tm_year=2010, tm_mon=1, tm_mday=23, tm_hour=5,
tm_min=8, tm_sec=39, tm_wday=5,
   tm_yday=23, tm_isdst=0)
   >>> time.timezone
   -21600
   >>> time.tzname
    ('OMST', 'OMSST')



More information about the Python-list mailing list