Time Functions

The following functions are used with system time.

FunctionDescription
GetSystemTimeRetrieves the current system date and time in UTC format.
GetSystemTimeAdjustmentDetermines whether the system is applying periodic time adjustments to its time-of-day clock.
GetTimeFormatFormats a system time as a time string for a specified locale.
NtQuerySystemTimeReturns the system time.
RtlLocalTimeToSystemTimeConverts the specified local time to system time.
RtlTimeToSecondsSince1970Converts the specified system time to the number of seconds since the first second of January 1, 1970.
SetSystemTimeSets the current system time and date.
SetSystemTimeAdjustmentEnables or disables periodic time adjustments to the system's time-of-day clock.
SystemTimeToFileTimeConverts a system time to a file time.
SystemTimeToTzSpecificLocalTimeConverts a UTC time to a specified time zone's corresponding local time.
TzSpecificLocalTimeToSystemTimeConverts a local time to a UTC time.

 

The following functions are used with local time.

FunctionDescription
EnumDynamicTimeZoneInformationEnumerates dynamic daylight saving time information entries stored in the registry.
FileTimeToLocalFileTimeConverts a UTC file time to a local file time.
GetDynamicTimeZoneInformationRetrieves the current time zone and dynamic daylight saving time settings.
GetDynamicTimeZoneInformationEffectiveYearsRetrieves a range, expressed in years, for which a DYNAMIC_TIME_ZONE_INFORMATION has valid entries.
GetLocalTimeRetrieves the current local date and time.
GetTimeZoneInformationRetrieves the current time zone settings.
GetTimeZoneInformationForYearRetrieves the time zone settings for the specified year and time zone.
RtlLocalTimeToSystemTimeConverts the specified local time to system time.
SetDynamicTimeZoneInformationSets the current time zone and dynamic daylight saving time settings.
SetLocalTimeSets the current local time and date.
SetTimeZoneInformationSets the current time zone settings.
SystemTimeToTzSpecificLocalTimeConverts a UTC time to a specified time zone's corresponding local time.
SystemTimeToTzSpecificLocalTimeExConverts a UTC time with dynamic daylight saving time settings to a specified time zone's corresponding local time.
TzSpecificLocalTimeToSystemTimeConverts a local time to a UTC time.
TzSpecificLocalTimeToSystemTimeExConverts a local time with dynamic daylight saving time settings to UTC time.

 

The following functions are used with file time.

FunctionDescription
CompareFileTimeCompares two file times.
FileTimeToLocalFileTimeConverts a UTC file time to a local file time.
FileTimeToSystemTimeConverts a file time to system time format.
GetFileTimeRetrieves the date and time that the specified file or directory was created, last accessed, and last modified.
GetSystemTimeAsFileTimeRetrieves the current system date and time in UTC format.
LocalFileTimeToFileTimeConverts a local file time to a file time based on UTC.
SetFileTimeSets the date and time that the specified file or directory was created, last accessed, or last modified.
SystemTimeToFileTimeConverts a system time to a file time.

 

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

FunctionDescription
DosDateTimeToFileTimeConverts MS-DOS date and time values to a file time.
FileTimeToDosDateTimeConverts a file time to MS-DOS date and time values.

 

The following functions are used with Windows time.

FunctionDescription
GetSystemTimesRetrieves system timing information.
GetTickCountRetrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.
GetTickCount64Retrieves the number of milliseconds that have elapsed since the system was started.

 

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

FunctionDescription
QueryPerformanceCounterRetrieves the current value of the high-resolution performance counter.
QueryPerformanceFrequencyRetrieves the frequency of the high-resolution performance counter.

 

The following functions are used with the auxiliary performance counter.

FunctionDescription
QueryAuxiliaryCounterFrequencyQueries the auxiliary counter frequency.
ConvertAuxiliaryCounterToPerformanceCounterConverts 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.
ConvertPerformanceCounterToAuxiliaryCounterConverts 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.

FunctionDescription
QueryInterruptTimeGets the current interrupt-time count.
QueryInterruptTimePreciseGets the current interrupt-time count, in a more precise form than QueryInterruptTime does.
QueryUnbiasedInterruptTimeGets the current unbiased interrupt-time count. The unbiased interrupt-time count does not include time the system spends in sleep or hibernation.
QueryUnbiasedInterruptTimePreciseGets 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.