Chapter 20 Time

20.1 About Date and Time Functions

Win32 uses two time formats. File Time uses two 32-bit values as a combined 64-bit value representing the number of 100-nanosecond intervals that have elapsed since January 1st, 1601. Win32 uses the file-time format to record the creation time, last access time and last write time for files (if the file system records these times — some file systems do not record the last access and creation time). Functions are provided to get these time values for a file, set the time values and compare two file times.

For more information about files, see Chapter 5, “File I/O” and Chapter 6, “File Systems.”

System Time uses a data structure that contains separate member values for the year, month, day, hour, minute, second and millisecond. This time format is used for the internal system time (the “real time” clock). The Win32 API provides functions that convert between file time and system time and between the file time and the date and time formats used by MS-DOS.

For compatibility with earlier versions of Windows, Win32 also supports the GetTickCount and GetCurrentTime functions that return the time since Windows started running.