![set file modifcation time to oldest file time set file modifcation time to oldest file time](https://cdn-trinity.iartsupplies.co.uk/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/p/o/polly_pocket_folio_folder.jpg)
The NTFS file system records times on disk in UTC. Therefore, if it is daylight saving time, FindFirstFile takes daylight saving time into account, even if the file time you are converting is in standard time. FindFirstFile retrieves the local time from the FAT file system and converts it to UTC by using the current settings for the time zone and daylight saving time. When you restart the computer, the cached time that GetFileTime retrieves is correct. When it becomes daylight saving time, the time retrieved by GetFileTime is off an hour, because the cache is not updated. GetFileTime retrieves cached UTC times from the FAT file system. The FAT file system records times on disk in local time. Therefore, if it is daylight saving time, it takes daylight saving time into account, even if the file time you are converting is in standard time. However, FileTimeToLocalFileTime uses the current settings for the time zone and daylight saving time. To convert a file time to local time, use the FileTimeToLocalFileTime function. You must take care when using file times if the user has set the system to automatically adjust for daylight saving time. FileTimeToSystemTime converts the file time and copies the month, day, year, and time of day from the file time to a SYSTEMTIME structure. To make a file time easy to display to a user, use the FileTimeToSystemTime function. You can also obtain the system time in a FILETIME structure by calling the GetSystemTimeAsFileTime function.
![set file modifcation time to oldest file time set file modifcation time to oldest file time](https://3.bp.blogspot.com/-Q7x9qGecf-s/WxRHmLTWiQI/AAAAAAAABEE/-kYJ_wKcN_0QL03-FOkojEHlSHTek99JgCLcBGAs/s1600/linux-date-command.png)
If you plan to modify file times for specified files, you can convert a date and time of day to a file time by using the SystemTimeToFileTime function. The function compares two file times and returns a value that indicates which time is later or returns 0 (zero) if the times are equal. You can compare the times of different files by using the CompareFileTime function. This function lets you modify creation, last access, and last write times without changing the content of the file. To set the file times for a file, use the SetFileTime function. When writing to a file, the last write time is not fully updated until all handles that are used for writing are closed.
![set file modifcation time to oldest file time set file modifcation time to oldest file time](https://intellect.ml/th/25/blogs/id6826/2_746533acc1f955d7b220f285e69bf011.png)
These functions copy the file times to FILETIME structures in a WIN32_FIND_DATA structure. You can also retrieve file times using the FindFirstFile and FindNextFile functions. GetFileTime copies the creation, last access, and last write times to individual FILETIME structures. To retrieve the file times for a specified file, use the GetFileTime function. The NTFS file system delays updates to the last access time for a file by up to 1 hour after the last access. For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds and access time has a resolution of 1 day, so it is really the access date. Not all file systems can record creation and last access times, and not all file systems record them in the same manner. The only guarantee about a file time stamp is that the file time is correctly reflected when the handle that makes the change is closed. Time stamps are updated at various times and for various reasons. For example, a file that is saved at 3:00pm PST in Washington is seen as 6:00pm EST in New York on an NTFS volume, but it is seen as 3:00pm EST in New York on a FAT volume. The FAT file system stores time values based on the local time of the computer. The NTFS file system stores time values in UTC format, so they are not affected by changes in time zone or daylight saving time. The system records file times when applications create, access, and write to files. A file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 A.M.