[python-win32] File Time: win32file vs Python ?

Tim Roberts timr at probo.com
Fri Jul 3 00:45:34 CEST 2009


Robert wrote:
> >>> os.path.getmtime('x.txt')
> 1193160881
> >>> int(win32file.GetFileAttributesExW('x.txt')[-2])
> 1193153681
> >>> int(win32file.GetFileAttributesExW('x.txt')[-2]) -
> os.path.getmtime('x.txt')
> -7200
>
> (Win XP)
> is this a bug, or is there a issue with timezones/summer time? aren't
> time.time() values absolute?

The meaning of time.time isn't really relevant to this. 
GetFileAttributesExW returns values directly from the file system, and
NTFS happens to store its timestamps in UTC.  os.path.getmtime adjusts
to local time.

FAT file systems record timestamps in local time, which causes the
reported times to change during summer time.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list