Article ID: 190315 - Last Review: January 23, 2007 - Revision: 3.1 Last accessed time and last modified time reported by C Run-Time (CRT) functions can be adjusted by using the "Automatically Adjust for Daylight Saving Time" optionThis article was previously published under Q190315 On This PageSYMPTOMS
You can adjust the time of last access and time of last modification
reported by the CRT functions _stat, _fstat, _findfirst, and _findnext for
daylight saving time under the NTFS file system. This manifests itself as
a change in the time last modified when making the switch to daylight
savings time from standard time or vice-versa.
CAUSE
All of the previously referenced CRT functions call the Win32 API
FileTimeToLocalFileTime. FileTimeToLocalFileTime adjusts the file times for
daylight saving time if "Automatically adjust clock for daylight saving
changes" is selected in the Date/Time Properties dialog box for the system
clock. This behavior is by design under the NTFS file system.
RESOLUTION
One way to avoid the behavior is to clear "Automatically adjust clock for
daylight saving changes" in the Date/Time Properties dialog box for the
system clock. Other workarounds depend upon the calculations or assumptions
that are made based on the date/time last modified that is reported for a
file. Note If the time last modified is between 12:00 am and 1:00 am, the date last modified is also changed when the adjustment subtracts an hour from the time last modified in the Fall. Similarly, files with a time last modified between 11:00 pm and midnight will have their date last modified when the adjustment advances the time one hour in the Spring. STATUS
This behavior is by design. MORE INFORMATION
This behavior is specific to the NTFS file system, and does not reproduce
on a system using the FAT file system. Note that the CRT and the operating
system report the same time last modified under all circumstances.
In the steps below, references to stat.exe mean the program generated by compiling stat.c, which appears below: Sample codeSteps to reproduce the behavior (must be an NTFS drive)
APPLIES TO
| Article Translations
|

Back to the top
