Time Functions

The following functions are used with system time.

Function Description
GetSystemTime Retrieves the current system date and time in UTC format.
GetSystemTimeAdjustment Determines whether the system is applying periodic time adjustments to its time-of-day clock.
GetTimeFormat Formats a system time as a time string for a specified locale.
NtQuerySystemTime Returns the system time.
RtlLocalTimeToSystemTime Converts the specified local time to system time.
RtlTimeToSecondsSince1970 Converts the specified system time to the number of seconds since the first second of January 1, 1970.
SetSystemTime Sets the current system time and date.
SetSystemTimeAdjustment Enables or disables periodic time adjustments to the system's time-of-day clock.
SystemTimeToFileTime Converts a system time to a file time.
SystemTimeToTzSpecificLocalTime Converts a UTC time to a specified time zone's corresponding local time.
TzSpecificLocalTimeToSystemTime Converts a local time to a UTC time.

 

The following functions are used with local time.

Function Description
EnumDynamicTimeZoneInformation Enumerates dynamic daylight saving time information entries stored in the registry.
FileTimeToLocalFileTime Converts a UTC file time to a local file time.
GetDynamicTimeZoneInformation Retrieves the current time zone and dynamic daylight saving time settings.
GetDynamicTimeZoneInformationEffectiveYears Retrieves a range, expressed in years, for which a DYNAMIC_TIME_ZONE_INFORMATION has valid entries.
GetLocalTime Retrieves the current local date and time.
GetTimeZoneInformation Retrieves the current time zone settings.
GetTimeZoneInformationForYear Retrieves the time zone settings for the specified year and time zone.
RtlLocalTimeToSystemTime Converts the specified local time to system time.
SetDynamicTimeZoneInformation Sets the current time zone and dynamic daylight saving time settings.
SetLocalTime Sets the current local time and date.
SetTimeZoneInformation Sets the current time zone settings.
SystemTimeToTzSpecificLocalTime Converts a UTC time to a specified time zone's corresponding local time.
SystemTimeToTzSpecificLocalTimeEx Converts a UTC time with dynamic daylight saving time settings to a specified time zone's corresponding local time.
TzSpecificLocalTimeToSystemTime Converts a local time to a UTC time.
TzSpecificLocalTimeToSystemTimeEx Converts a local time with dynamic daylight saving time settings to UTC time.

 

The following functions are used with file time.

Function Description
CompareFileTime Compares two file times.
FileTimeToLocalFileTime Converts a UTC file time to a local file time.
FileTimeToSystemTime Converts a file time to system time format.
GetFileTime Retrieves the date and time that the specified file or directory was created, last accessed, and last modified.
GetSystemTimeAsFileTime Retrieves the current system date and time in UTC format.
LocalFileTimeToFileTime Converts a local file time to a file time based on UTC.
SetFileTime Sets the date and time that the specified file or directory was created, last accessed, or last modified.
SystemTimeToFileTime Converts a system time to a file time.

 

The following functions are used with MS-DOS date and time.

Function Description
DosDateTimeToFileTime Converts MS-DOS date and time values to a file time.
FileTimeToDosDateTime Converts a file time to MS-DOS date and time values.

 

The following functions are used with Windows time.

Function Description
GetSystemTimes Retrieves system timing information.
GetTickCount Retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.
GetTickCount64 Retrieves the number of milliseconds that have elapsed since the system was started.

 

The following functions are used with high-resolution performance counters.

Function Description
QueryPerformanceCounter Retrieves the current value of the high-resolution performance counter.
QueryPerformanceFrequency Retrieves the frequency of the high-resolution performance counter.

 

The following functions are used with the auxiliary performance counter.

Function Description
QueryAuxiliaryCounterFrequency Queries the auxiliary counter frequency.
ConvertAuxiliaryCounterToPerformanceCounter Converts the specified auxiliary counter value to the corresponding performance counter value; optionally provides the estimated conversion error in nanoseconds due to latencies and maximum possible drift.
ConvertPerformanceCounterToAuxiliaryCounter Converts the specified performance counter value to the corresponding auxiliary counter value; optionally provides the estimated conversion error in nanoseconds due to latencies and maximum possible drift.

 

The following function is used with interrupt time.

Function Description
QueryInterruptTime Gets the current interrupt-time count.
QueryInterruptTimePrecise Gets the current interrupt-time count, in a more precise form than QueryInterruptTime does.
QueryUnbiasedInterruptTime Gets the current unbiased interrupt-time count. The unbiased interrupt-time count does not include time the system spends in sleep or hibernation.
QueryUnbiasedInterruptTimePrecise Gets the current unbiased interrupt-time count, in a more precise form than QueryUnbiasedInterruptTime does. The unbiased interrupt-time count does not include time the system spends in sleep or hibernation.