Problems with the date of modification of files on the flash drive inwindows

A

Aleksey

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:

1263998652.0


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

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

Summer for Windows
-----------------------------
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.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) 0


From Linux for summer:
---------------------------------
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.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) ('OMST', 'OMSST')


From Linux for winter:
------------------------------------
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.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) ('OMST', 'OMSST')
 
N

Nobody

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.

Timestamps stored on a FAT filesystem use an unspecified timezone. When a
Windows PC writes a timestamp to a FAT filesystem, it stores the current
local time. For devices such as cameras, the timestamp will be whatever's
in the device's clock if it has one (even if it does, there's no
guarantee that it's accurate), or some arbitrary value otherwise.

When reading a timestamp, it's just used as-is, i.e. it's a local time
with no timezone specified. There is no way to convert this value to UTC
or to a specific timezone.

If you're using FAT, timestamps are pretty much meaningless unless the
device never travels between timezones (in which case, they'll probably
be roughly correct or wrong by roughly an hour either way due to DST).

When it comes to timezones, anything developed prior to NT
basically pretends that they don't exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top