Y2038 in the “C” Programming Language

The “C” programming language is one of the most popular computer languages in the history of computing. The Y2038 issue originated in “C”, while it was being developed along with UNIX. The ‘heart’ of the Y2038 issue is the representation of time in seconds as a 32-bit integer (usually via a variable of type time_t). “time_t” is usually a 32-bit signed integer on 32-bit systems, and 64-bit signed integer on 64-bit systems. The epoch is usually midnight on Jan 1, 1970. The maximum number of seconds that can be represented in a 32-bit quantity will be exceeded after Jan 19, 2038 at 3:14:07 GMT.

One very appealing aspect of “C” is that it gives programmers absolute power and flexibility, but of course this also means that even small programming errors or bad assumptions can cause unintended consequences. As one example, any variable in “C” can be cast to another type, either implicitly or explicitly. If a cast is implicit (and there is a loss of precision), the compiler will at least print a warning. If a cast is explicit, the compiler may not even print a warning. As a case in point, if a programmer writing code on a 64-bit platform explicitly casts a variable of type time_t to another variable which happens to be a 32-bit signed integer, nothing bad may happen until the Y2038 rollover. After that time, what happens will depend on the program, but generally it won’t be good!

When faced with the task of finding and addressing Y2038 in “C” code, one approach is to search for all time-related functions. However, the usage of time in “C” is a fairly complex subject. There are numerous API functions, data structures, data types, and environment variables related to time. Even though “C” is standardized, significant differences do exist between implementations on different platforms. Each platform’s implementation can also evolve over time.

The table below is an attempt to list all API functions, data structures, data types, and environment variables having to do with time for some of the most popular platforms, including Linux, Microsoft Windows, Apple OSX, and VxWorks. Columns are also included for ISO and POSIX standards. As there are multiple versions of ISO and POSIX standards, the columns provided generally reflect the most recent versions. (This table is an ongoing work in progress. Over time, we plan to include additional platforms and additional links to external references (e.g. MSDN pages, etc.). Many such links are already included. Please let us know if you find errors or omissions, or have other suggestions.

On 32-bit platforms, any and all use of time in any way could be the source of Y2038 issues. On 64-bit systems, the platform usually provides a 64-bit time, which makes it possible to be Y2038 compliant. However, it is possible that variables with values of time in seconds get cast into 32-bit integers, perhaps when printing or conversion of some sort, or other processing. We therefore strongly advise that *ALL* usage of time be checked for Y2038 issues, even on 64-bit systems.

Please note that Y2038 issues are possible in “C” code outside of all standard uses. This is because times can come from external sources, such as embedded binary fields within network protocols and databases. Therefore, the approach of finding and fixing all of the functions listed below will not necessarily correct all Y2038 issues.

CategoryNameHeaderC11 (ISO)POSIXLinuxWindowsMac OSXVxWorksZephyrFreeRTOSDescriptionComments
Constant/Definition _USE_32BIT_TIME_Tn/aNoNoNoYesNoNoNoNoOn 64-bit Windows, forces time_t to 32-bits
Constant/Definition__DARWIN_CLK_TCKi386/_limits.hNoNoNoNoYes (100)NoNoNoCLOCKS_PER_SECOND when __DARWIN_UNIX03 not defined
Constant/Definition_POSIX_TZNAME_MAXlimits.hNoYesNoNoYesYesYesYesMax length of the tzname variable
Constant/Definition_SC_CLK_TCKunistd.hNoYesYesNoYesNoYesYesThe system clock rate in ticks per secReplaced CLK_TCK
Constant/Definition_XTIME_NSECS_PER_TICKthr/xtimec.hNoNoNoYesNoNoNoNo# nsecs per tick (as related to xtime), defined as 100
Constant/Definition_XTIME_TICKS_PER_TIME_Tthr/xtimec.hNoNoNo10MNoNoNoNo# ticks per sec (as related to xtime), defined as 10M (__LONGLONG)
Constant/DefinitionCLK_TCKVariesNoNo*Yes*YesYesNoNoNoThe system clock rate in ticks per sec (* = marked as obsolete)Marked as obsolete (TBD: When did it go obsolete?)
Constant/DefinitionCLOCKS_PER_SECtime.hYes1M1M10001M or 100sysClkRateGetNoYesThe system clock rate in ticks per secMac OSX is 100 when __DARWIN_UNIX03 is not defined, or 1M otherwise
Constant/DefinitionTZNAME_MAXlimits.hNoYesYesYesNoNoYesYesMax length of the tzname variable
CPU Usageclocktime.hYesYesYesYesYesYesYesYesGets the CPU time used, returned in a clock_t
CPU Usagegetrusagesys/resource.hNoYesYesNoYesNoYesNoGets info about resource utilization, returned in rusage structure
Current Time_ftimesys/timeb.hNoNoNoYesNoNoNoYesGets current time in secs by calling _ftime32 or _ftime64In FreeRTOS, this function returns an error
Current Time_ftime_ssys/timeb.hNoNoNoYesNoNoNoNoGets current time in secs by calling _ftime32_s or ftime64_s
Current Time_ftime32sys/timeb.hNoNoNoYesNoNoNoNoGets current time in secs from Jan 1, 1970, limited to Jan 19, 2038
Current Time_ftime32_ssys/timeb.hNoNoNoYesNoNoNoNoGets current time in secs from Jan 1, 1970, limited to Jan 19, 2038
Current Time_ftime64sys/timeb.hNoNoNoYesNoNoNoNoGets current time in secs from Jan 1, 1970, limited to Dec 31, 3000
Current Time_ftime64_ssys/timeb.hNoNoNoYesNoNoNoNoGets current time in secs from Jan 1, 1970, limited to Dec 31, 3001
Current Time_time32time.hNoNoNoYesNoNoNoNoWindows function for getting time in 32-bit time_t
Current Time_time64time.hNoNoNoYesNoNoNoNoWindows function for getting time in 64-bit time_t
Current Timeftimesys/timeb.hNoNo*YesYesYesNoYesNoGets current time in secs and msecs since epoch of Jan 1, 1970 as timebWas in POSIX.1-2001, removed in POSIX.1-2008
Current TimeGetDynamicTimeZoneInformationWindows.hNoNoNoYesNoNoNoNoReturns the current timezone and dynamic DST settings
Current TimeGetFileAttributesExWindows.hNoNoNoYesNoNoNoNoReturns various data including FILETIMEs for create, write, and access
Current TimeGetFileTimeWindows.hNoNoNoYesNoNoNoNoReturns the (creation, last access, and last write) times for a file or folder
Current TimeGetLocalTimeWindows.hNoNoNoYesNoNoNoNoGets the current system time (local time format), in a SYSTEMTIME struct
Current TimeGetSystemTimeWindows.hNoNoNoYesNoNoNoNoGets the current system time (UTC format), in SYSTEMTIME struct
Current TimeGetSystemTimeAdjustmentWindows.hNoNoNoYesNoNoNoNoGets system clock adjustments, 100 nsec units in DWORD
Current TimeGetSystemTimeAsFileTimeWindows.hNoNoNoYesNoNoNoNoGets accurate system time in UTC format as a FILETIMETBD: What is the epoch
Current TimeGetSystemTimePreciseAsFileTimeWindows.hNoNoNoYesNoNoNoNoGets accurate system time in UTC format as a FILETIMETBD: What is the epoch
Current TimeGetSystemTimesWindows.hNoNoNoYesNoNoNoNoGets idle, kernel, and user times in FILETIME structs
Current TimeGetTickCountWindows.hNoNoNoYesNoNoNoNoGets # of msecs since system start, rolls over after 49.7 days
Current TimeGetTickCount64Windows.hNoNoNoYesNoNoNoNoGets # of msecs since system start, with resolution of 10-16 msecs
Current Timegettimeofdaysys/time.hNoYes*YesNoYesNoYesYesGets current date/time as a timeval structPOSIX.1-2008 marked as obsolete
Current TimeSetDynamicTimeZoneInformationWindows.hNoNoNoYesNoNoNoNoSets the current timezone and dynamic DST settings
Current TimeSetFileTimeWindows.hNoNoNoYesNoNoNoNoSets the (creation, last access, and last write) times for a file or folder
Current TimeSetLocalTimeWindows.hNoNoNoYesNoNoNoNoSets the current local date and time
Current TimeSetSystemTimeWindows.hNoNoNoYesNoNoNoNoSets the current system time using SYSTEMTIME struct with UTC
Current TimeSetSystemTimeAdjustmentWindows.hNoNoNoYesNoNoNoNoControls periodic adjustments to system clock, 100 nsec units in DWORD
Current Timesettimeofdaysys/time.hNoNoYesNoYesNoYesYesSets current system time based on value in timeval struct
Current Timestimetime.hNoNoYesNoNoNoNoYesSets current system time based on value in time_t
Current Timetimetime.hYesYesYesYesYesYesYesYesGets time since epoch in a time_tEpoch on many systems is Jan 1, 1970, but not on all systems
Env Variable_daylightn/aNoNoNoYesNoNoNoNoNonzero if DST is specified in TZ or determined from the OS, otherwise 0
Env Variable_dstbiasn/aNoNoNoYesNoNoNoNoDifference between standard and DST in seconds
Env Variable_timezonen/aNoNoNoYesNoNoNoNoDifference between UTC and local time in seconds
Env Variable_tzname[0]n/aNoNoNoYesNoNoNoNoNon-DST zone name derived from TZ, e.g. "PST"
Env Variable_tzname[1]n/aNoNoNoYesNoNoNoNoDST zone name derived from TZ, e.g. "PDT"
Env VariableDATEn/aNoNoNoYesNoNoNoNoHolds the current date, e.g. "Fri 12/25/2015"
Env VariableDATEMSKn/aNoYesYesNoYesNoNoNoIndicates the pathname of the template file used by getdate()
Env VariableHZn/aNoNoYesNoNoNoYesYesTells # of timer interrupts per second, infrequently used
Env VariableTIMEn/aNoNoNoYesNoNoNoNoHolds the current time, e.g. "23:42:49.56"
Env VariableTIMEZONEn/aNoNoNoNoNoYesNoNoRepresents timezone information
Env VariableTZn/aNoYesYesYesYesNoYesNoRepresents timezone information
Env VariableTZDIRn/aNoNoYesNoNoNoNoNoUsed by glibc to specify an alternate timezone information file
File System_fstatsys/stat.hNoNoNoYesYesNoYesYesGets info about open file, using _stat struct
File System_fstat32sys/stat.hNoNoNoYesNoNoNoNoGets info about open file, using _stat32 structLow occurrence, code should use fstat or _fstat
File System_fstat32i64sys/stat.hNoNoNoYesNoNoNoNoGets info about open file, using _stat32i64 struct
File System_fstat64sys/stat.hNoNoNoYesNoNoYesNoGets info about open file, using __stat64 struct
File System_fstat64i32sys/stat.hNoNoNoYesNoNoNoNoGets info about open file, using _stat64i32 struct
File System_fstati64sys/stat.hNoNoNoYesNoNoNoNoGets info about open file, using _stati64 struct
File System_futimesys/utime.hNoNoNoYesNoNoNoNoSets mod time on open file, using _utimbuf struct
File System_futime32sys/utime.hNoNoNoYesNoNoNoNoSets mod time on open file, using _utimbuf32 struct
File System_futime64sys/utime.hNoNoNoYesNoNoNoNoSets mod time on open file, using _utimbuf64 struct
File System_statsys/stat.hNoNoNoYesNoNoYesNoGets info about a file, returned as _stat structLow occurrence, code should use fstat or _fstat
File System_stat32sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stat32 structLow occurrence, code should use fstat or _fstat
File System_stat32i64sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stat32i64 struct
File System_stat64sys/stat.hNoNoNoYesNoNoYesNoGets info about a file, returned as __stat64 struct
File System_stat64i32sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stat64i32 struct
File System_stati64sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stati64 struct
File System_utimesys/utime.hNoNoNoYesNoNoNoYesSets mod time on file, using _utimbuf struct
File System_utime32sys/utime.hNoNoNoYesNoNoNoNoSets mod time on file, using _utimbuf32 struct
File System_utime64sys/utime.hNoNoNoYesNoNoNoNoSets mod time on file, using _utimbuf64 struct
File System_wstatsys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stat struct
File System_wstat32sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stat32 struct
File System_wstat32i64sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stat32i64 struct
File System_wstat64sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as __stat64 struct
File System_wstat64i32sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stat64i32 struct
File System_wstati64sys/stat.hNoNoNoYesNoNoNoNoGets info about a file, returned as _stati64 struct
File System_wutimesys/utime.hNoNoNoYesNoNoNoNoSets mod time on file, using _utimbuf struct
File System_wutime32sys/utime.hNoNoNoYesNoNoNoNoSets mod time on file, using _utimbuf32 struct
File System_wutime64sys/utime.hNoNoNoYesNoNoNoNoSets mod time on file, using _utimbuf64 struct
File Systemfstatsys/stat.hNoYesYesYesYesYesYesYesGets info about open file, returned in stat struct
File Systemfstat64sys/stat.hNoNoNoNoYesNoYesYesGets info about open file, returned in stat64 struct
File Systemfstatatsys/stat.hNoYesYesYesYesNoYesYesGet info about an open file relative to given path, returned in stat struct
File Systemfstatat64sys/stat.hNoNoNoNoYesNoNoYesGet info about an open file relative to given path, returned in stat64 struct
File SystemGetFileTimeWindows.hNoNoNoYesNoNoNoNoGets create, last write, and last access times for file opened with CreateFile
File Systemlstatsys/stat.hNoYesYesNoYesNoYesYesGets info about a symbolic link, returned in stat struct
File Systemlstat64sys/stat.hNoNoYesNoYesNoNoYesGets info about a symbolic link, returned in stat64 struct
File Systemstatsys/stat.hNoYesYesYesYesYesYesYesGets info about a file, returned in stat struct
File Systemstat64sys/stat.hNoNoNoNoYesNoYesYesGets info about a file, returned in stat64 struct
File Systemutimeutime.hNoYesYesYesYesYesNoYesSet file access and mod times, using utimbuf struct
Format Conv_ctime32time.hNoNoNoYesNoNoNoNoConvert a time32_t to a date/time string
Format Conversion_ctime32_stime.hNoNoNoYesNoNoNoNoConvert a time32_t to a date/time string
Format Conversion_ctime64time.hNoNoNoYesNoNoNoNoConvert a time64_t to a date/time string
Format Conversion_ctime64_stime.hNoNoNoYesNoNoNoNoConvert a time64_t to a date/time string
Format Conversion_gmtime32time.hNoNoNoYesNoNoNoNoConvert a time32_t to a tm struct
Format Conversion_gmtime32_stime.hNoNoNoYesNoNoNoNoConvert a time32_t to a tm struct
Format Conversion_gmtime64time.hNoNoNoYesNoNoNoNoConvert a time64_t to a tm struct
Format Conversion_gmtime64_stime.hNoNoNoYesNoNoNoNoConvert a time64_t to a tm struct
Format Conversion_localtime32time.hNoNoNoYesNoNoNoNoConvert a time32_t to a tm struct, adjusting for time zone
Format Conversion_localtime32time.hNoNoNoYesNoNoNoNoVersion of localtime for 32-bit time_t
Format Conversion_localtime32_stime.hNoNoNoYesNoNoNoNoConvert a time32_t to a tm struct, adjusting for time zone
Format Conversion_localtime64time.hNoNoNoYesNoNoNoNoConvert a time64_t to a tm struct, adjusting for time zone
Format Conversion_localtime64time.hNoNoNoYesNoNoNoNoVersion of localtime for 64-bit time_t (valid until Dec 31, 3000)
Format Conversion_localtime64_stime.hNoNoNoYesNoNoNoNoConvert a time64_t to a tm struct, adjusting for time zone
Format Conversion_mkgmtimetime.hNoNoNoYesNoNoNoNoConvert a UTC time in a tm struct to a UTC time in a time_tEpoch is Jan 1, 1970
Format Conversion_mkgmtime32time.hNoNoNoYesNoNoNoNoConvert a UTC time in a tm struct to a UTC time in a time32_t
Format Conversion_mkgmtime64time.hNoNoNoYesNoNoNoNoConvert a UTC time in a tm struct to a UTC time in a time64_t
Format Conversion_mktime32time.hNoNoNoYesNoNoNoNoConvert a local time in tm struct to a time32_t
Format Conversion_mktime64time.hNoNoNoYesNoNoNoNoConvert a local time in tm struct to a time64_t
Format Conversion_strdatetime.hNoNoNoYesNoNoNoNoCopies the current system date to a buffer in format DD/MM/YYDeprecated
Format Conversion_strdate_stime.hNoNoNoYesNoNoNoNoCopies the current system date to a buffer in format DD/MM/YY
Format Conversion_strftime_ltime.hNoNoNoYesNoNoNoNoConvert a time in a tm struct to a string using a specified format and locale
Format Conversion_strtimetime.hNoNoNoYesNoNoNoNoCopied the current system time to a buffer in format HH:MM:SSDeprecated
Format Conversion_strtime_stime.hNoNoNoYesNoNoNoNoCopied the current system time to a buffer in format HH:MM:SS
Format Conversion_tstrdatetchar.hNoNoNoYesNoNoNoNoSame as _wstrdateDeprecated
Format Conversion_tstrdate_stchar.hNoNoNoYesNoNoNoNoSame as _wstrdate_s
Format Conversion_tstrtimetchar.hNoNoNoYesNoNoNoNoSame as _wstrtimeDeprecated
Format Conversion_tstrtime_stchar.hNoNoNoYesNoNoNoNoSame as _wstrtime_s
Format Conversion_wasctime_stime.hNoNoNoYesNoNoNoNoConvert a tm struct to a string
Format Conversion_wcsftime_lwchar.hNoNoNoYesNoNoNoNoConvert time in tm struct to wide char string using a specified format and locale
Format Conversion_wctimetime.h or wchar.hNoNoNoYesNoNoNoNoConvert a time_t to a wide date/time string
Format Conversion_wctime_stime.h or wchar.hNoNoNoYesNoNoNoNoConvert a time_t to a wide date/time string
Format Conversion_wctime32time.h or wchar.hNoNoNoYesNoNoNoNoConvert a time32_t to a wide date/time string
Format Conversion_wctime32_stime.h or wchar.hNoNoNoYesNoNoNoNoConvert a time32_t to a wide date/time string
Format Conversion_wctime64time.h or wchar.hNoNoNoYesNoNoNoNoConvert a time64_t to a wide date/time string
Format Conversion_wctime64_stime.h or wchar.hNoNoNoYesNoNoNoNoConvert a time64_t to a wide date/time string
Format Conversion_wstrdatetime.hNoNoNoYesNoNoNoNoThe wide-character version of _strdateDeprecated
Format Conversion_wstrdate_stime.hNoNoNoYesNoNoNoNoThe wide-character version of _strdate_s
Format Conversion_wstrtimetime.hNoNoNoYesNoNoNoNoThe wide-character version of _strtimeDeprecated
Format Conversion_wstrtime_stime.hNoNoNoYesNoNoNoNoThe wide-character version of _strtime_s
Format Conversionasctimetime.hYesYesYesYesYesYesYesYesConvert a date/time in a tm struct to a string
Format Conversionasctime_rtime.hNoYesYesNoYesYesYesYesConvert a date/time in a tm struct to a string
Format Conversionasctime_stime.hYesNoNoYesYesNoNoNoConvert a tm struct to a string
Format Conversionctimetime.hYesYesYesYesYesYesYesYesConvert a time_t to a date/time string
Format Conversionctime_rtime.hNoYesYesNoYesYesYesYesConvert a time_t to a date/time string
Format Conversionctime_stime.hYesNoNoYesNoNoNoNoConvert a time_t to a date/time string
Format ConversionDosDateTimeToFileTimeWindows.hNoNoNoYesNoNoNoNoConvert MSDOS date/time to FILETIME MSDOS date uses a 7-bit year offset from 1980 (max date is Dec 31, 2107)
Format ConversionExLocalTimeToSystemTimeWdm.hNoNoNoYesNoNoNoNoConvert system time for current time zone to unbiased GMTFor drivers etc, not user apps, uses LARGE_INT
Format ConversionExSystemTimeToLocalTimeWdm.hNoNoNoYesNoNoNoNoConvert GMT system time to local system time for current time zoneFor drivers etc, not user apps, uses LARGE_INT
Format ConversionFileTimeToDosDateTimeWindows.hNoNoNoYesNoNoNoNoConvert FILETIME to MSDOS date/timeMSDOS date uses a 7-bit year offset from 1980 (max date is Dec 31, 2107)
Format ConversionFileTimeToLocalFileTimeWindows.hNoNoNoYesNoNoNoNoConvert a UTC-based FILETIME to a local time-based FILETIME
Format ConversionFileTimeToSystemTimeWindows.hNoNoNoYesNoNoNoNoConvert a FILETIME to a SYSTEMTIME (broken out, UTC-based)
Format Conversiongetdatetime.hNoYesYesNoYesNoYesYesConverts date/time string to struct tm
Format Conversiongetdate_rtime.hNoNoYesNoNoNoYesNoGNU re-entrant version of getdate
Format Conversiongmtimetime.hYesYesYesYesYesYesYesYesConvert a time_t to a tm struct
Format Conversiongmtime_rtime.hNoYesYesNoYesYesYesYesConvert a time_t to a tm struct
Format Conversiongmtime_stime.hYesNoNoYesNoNoNoNoConvert a time_t to a tm struct
Format ConversionLocalFileTimeToFileTimeWindows.hNoNoNoYesNoNoNoNoConvert a local FILETIME to a FILETIME based on UTC
Format Conversionlocaltimetime.hYesYesYesYesYesYesYesYesConvert a time_t to a tm struct, adjusting for time zone
Format Conversionlocaltime_rtime.hNoYesYesNoYesYesYesNoConvert a time_t to a tm struct, adjusting for time zone
Format Conversionlocaltime_stime.hYesNoNoYesNoNoNoNoConvert a time_t to a tm struct, adjusting for time zone
Format Conversionmktimetime.hYesYesYesYesYesYesYesYesConvert a local time in tm struct to a time_t
Format ConversionRtlLocalTimeToSystemTimeWindows.hNoNoNoYesNoNoNoNoConvert local time in LARGE_INTEGER to system time in LARGE_INTEGEROnly available on Win2k and XP. TBD: Confirm the epoch for this function
Format ConversionRtlTimeToSecondsSince1970Windows.hNoNoNoYesNoNoNoNoConvert system time in LARGE_INTEGER to # seconds since 1970 in ULONGOnly available on Win2k and XP, and only for system times from 1970 to 2105
Format Conversionstrftimetime.hYesYesYesYesYesYesYesYesConvert a time in a tm struct to a string using a specified format
Format Conversionstrftime_ltime.hNoNoNoNoYesNoYesYesConvert a time in a tm struct to a string using a specified format and locale
Format Conversionstrptimetime.hNoYesYesNoYesNoYesYesConvert a string containing date/time to a tm struct using a given format
Format Conversionstrptime_ltime.hNoNoNoNoYesNoYesNoConvert a string containing date/time to a tm struct using a given format and locale
Format ConversionSystemTimeToFileTimeWindows.hNoNoNoYesNoNoNoNoConvert time in a SYSTEMTIME struct (in UTC) to a FILETIME
Format ConversionSystemTimeToTzSpecificLocalTimeWindows.hNoNoNoYesNoNoNoNoConvert UTC tie in SYSTEMTIME struct to SYSTEMTIME in specified time zone
Format ConversionSystemTimeToTzSpecificLocalTimeExWindows.hNoNoNoYesNoNoNoNoConvert UTC tie in SYSTEMTIME struct to SYSTEMTIME in specified time zoneAlso handles DST
Format Conversiontimegmtime.hNoNoYesNoYesNoYesYesConvert a UTC-based time in tm struct to a time_tOpposite of gmtime
Format Conversiontimelocaltime.hNoNoYesNoYesNoNoNoConvert a local time in tm struct to a time_t (Equivalent of mktime)Opposite of localtime
Format ConversionTzSpecificLocalTimeToSystemTimeWindows.hNoNoNoYesNoNoNoNoConvert a local time in SYSTEMTIME to a UTC time also in SYSTEMTIME
Format ConversionTzSpecificLocalTimeToSystemTimeExWindows.hNoNoNoYesNoNoNoNoConvert a local time in SYSTEMTIME to a UTC time also in SYSTEMTIMEAlso handles DST
Format Conversionwcsftimewchar.hYesYesYesYesYesNoYesYesConvert a time in a tm struct to a wide char string using a specified format
Format Conversionwcsftime_lwchar.hNoNoNoNoNoNoNoYesConvert a time in a tm struct to a wide char string using a specified format and locale
Global Variabledaylighttime.hNoYesYesYesYesNoNoYesSet to 0 to disable DST conversionsUsage in Windows & Mac seems undocumented
Global Variabletimezonetime.hNoYesYesYesYesNoYesYesThe difference in seconds between UTC and local standard timeUsage in Windows & Mac seems undocumented
Global Variabletzname[0]time.hNoYesYesYesYesNoYesYesThe string for local standard time (without DST), e.g. "EST"Usage in Windows & Mac seems undocumented
Global Variabletzname[1]time.hNoYesYesYesYesNoYesYesThe string for local daylight time (with DST), e.g. "EDT"Usage in Windows & Mac seems undocumented
Macro__DATE__N/AYesNoYesYesYesYesYesYesString of the current date in the form "Mmm dd yyyy"
Macro__TIME__N/AYesNoYesYesYesYesYesYesString of the current time in the form "hh:mm:ss"
MacroLC_TIMElocale.hYesYesYesYesYesYesYesYesUsed for formatting date and time values with strftime
Msg Queuemq_timedreceivemqueue.hNoYesYesNoNoYesYesNoRcv a msg from a msg queue, wait max of absolute time in timespec struct
Msg Queuemq_timedsendmqueue.hNoYesYesNoNoYesYesNoSend a msg from a msg queue, wait max of absolute time in timespec struct
Simple Type__darwin_suseconds_tsys/_types.hNoNoNoNoYesNoNoNoA 32-bit signed integer representing usecs
Simple Type__darwin_time_ti386/_types.hNoNoNoNoYesNoNoNoApple's time_t (defined as 'long')
Simple Type__darwin_useconds_tsys/_types.hNoNoNoNoYesNoNoNoA 32-bit unsigned integer representing usecs
Simple Type__int64variesNoNoYesYesYesNoYesYesA signed 64-bit signed integer
Simple Type__suseconds_tbits/types.hNoNoYesNoNoNoYesNoA 32-bit signed integer representing usecs
Simple Type__time32_ttime.hNoNoNoYesNoNoNoNoA 32-bit signed integer (defined as long which is 32-bits on Windows)
Simple Type__time64_ttime.hNoNoNoYesNoNoNoNoA 64-bit signed integer (defined as __int64)
Simple Type__useconds_tbits/types.hNoNoYesNoNoNoYesNoA 32-bit unsigned integer representing usecs
Simple Typeclock_res_tmach/clock_types.hNoNoNoNoYesNoNoNoDefined as int
Simple Typeclock_tVariesYesYesYesYesYesYesYesYeslong on Linux and Windows, unsigned long on OSX, and unsigned int on VxWorks
Simple TypeDWORDVariesNoNoYesYesYesYesYesYesA 32-bit unsigned integer
Simple TypeINTSeveralNoNoNoYesNoNoNoNoSame as int
Simple Typeintn/aYesYesYesYesYesYesYesYesA signed integer; check platform for actual size
Simple TypeLONGSeveralNoNoNoYesNoYesYesYesSame as long (32-bits on all Windows)
Simple Typelongn/aYesYesYesYesYesYesYesYesA signed integer; check platform for actual size
Simple Typelong longn/aYesYesYesYesYesYesYesYesA signed 64-bit integer
Simple TypeLONGLONGSeveralNoNoNoYesNoYesNoNoSame as long long (64-bits)
Simple Typesize_tstddef.hYesYesYesYesYesYesYesYesDefined as unsigned int on VxWorks
Simple Typesuseconds_tsys/types.hNoYesYesNoYesNoYesYesA 32-bit signed integer representing usecs
Simple Typetime_ttime.hYesYesYesYesYesYesYesYesSecs since epoch; long on Linux and OSX, __time32_t or __time64_t on Windows, unsigned long on VxWorks for 32-bit systems
Simple TypeUINTSeveralNoNoNoYesNoNoNoNoSame as unsigned int
Simple TypeULONGSeveralNoNoNoYesNoYesNoYesSame as unsigned long (32-bits on all Windows)
Simple TypeULONGLONGSeveralNoNoNoYesNoYesNoYesSame as unsigned long long (64-bits)
Simple Typeunsigned intn/aYesYesYesYesYesYesYesYesAn unsigned integer; check platform for actual size
Simple Typeunsigned longn/aYesYesYesYesYesYesYesYesAn unsigned integer; check platform for actual size
Simple Typeunsigned long longn/aYesYesYesYesYesYesYesYesAn unsigned 64-bit integer
Simple Typeuseconds_tsys/types.hNoYesYesNoYesNoYesYesA 32-bit unsigned integer representing usecs
Sleep Func_sleepstdlib.hNoNoNoYesNoNoNoNoSleep for given # of (units unknown), in unsigned longTBD: what units; this function does not seem to be documented
Sleep Func_Thrd_sleepthr/xthreads.hNoNoNoYesNoNoNoNoSleep unti an absolute time given in an xtimeNot well documented
Sleep Funcclock_nanosleeptime.hNoYesYesNoNoYesYesYesSleep until an absolute time or relative time given in a timespec struct
Sleep Funck_busy_waitkernel.hNoNoNoNoNoNoYesNoSleep for given # of usecs, in a uint32_t
Sleep Funck_sleepkernel.hNoNoNoNoNoNoYesNoSleep for given # of ticks in int32_t, max dependent on tick duration
Sleep Funcnanosleeptime.hNoYesYesNoYesYesYesYesSleep for given # of nanoseconds given in a timespec struct
Sleep Funcsleepthr/threadNoNoNoYesNoNoNoNoSleep until the absolute time given in an xtime structThis is likely for Boost integration
Sleep Funcsleepposix/unistd.hNoNoNoNoNoNoNoYesSleep until the absolute time given in an unsigned int
Sleep FuncSleepWindows.hNoNoNoYesNoNoNoSim/TestSleep for given # of msecs in a DWORD
Sleep Funcsleepunistd.hNoYesYesNoYesYesYesYesSleep for given # of seconds in unsigned intWindows has sleep function in thr/thread class
Sleep Funcsleep_forthreadNoNoNoYesNoNoYesNoSleep until a relative timeClass
Sleep Funcsleep_untilthreadNoNoNoYesNoNoYesNoSleep until an absolute timeClass
Sleep Functhrd_sleepthr/threads.hYesNoNoYesNoNoYesNoSleep until an absolute time given in an xtimeNot well documented
Sleep Funcusleepunistd.hNoNo*YesNoYesNoYesYesSleep for given # of usecs, in a useconds_tMarked obsolete in POSIX.1-2001, Removed in POSIX.1-2008
StructureDYNAMIC_TIME_ZONE_INFORMATIONWindows.hNoNoNoYesNoNoNoNoSpecifies settings for a time zone and dynamic daylight saving time
StructureFILETIMEWindows.hNoNoNoYesNoNoNoNoContains 2 DWORDs for time since Jan 1, 1601 in units of 100 nsecs
StructureLARGE_INTEGERWtypes.IdlNoNoNoYesNoNoNoSim/TestA union containing 'LONGLONG QuadPart' (64-bit signed integer), etc
Structuremach_timespec_tmach/clock_types.hNoNoNoNoYesNoNoNoContains unsigned int for seconds and (signed) int for nsecs
StructureMMTIMEWindows.hNoNoNoYesNoNoNoNoContains timing information on various types of multimedia dataContains msecs in a DWORD, also SMPTE sub-struct has hours in a BYTE
Structurestruct __stat64sys/stat.hNoNoNoYesNoNoNoNoSame as _stat64
Structurestruct __timeb32sys/timeb.hNoNoNoYesNoNoNoNoContains __time32_t for time in secs, unsigned short for msecs
Structurestruct __timeb64sys/timeb.hNoNoNoYesNoNoNoNoContains __time64_t for time in secs, unsigned short for msecs
Structurestruct __utimbuf32sys/utime.hNoNoNoYesNoNoNoNoContains __time32_t for access and modification times
Structurestruct __utimbuf64sys/utime.hNoNoNoYesNoNoNoNoContains __time64_t for access and modification times
Structurestruct _statsys/stat.hNoNoNoYesNoNoNoNoDefined as _stat32 or _stat64i32 depending on _USE_32BIT_TIME_T
Structurestruct _stat32sys/stat.hNoNoNoYesNoNoNoNoContains __time32_t for st_atime, st_mtime, and st_ctime
Structurestruct _stat32i64sys/stat.hNoNoNoYesNoNoNoNoContains __time32_t for st_atime, st_mtime, and st_ctime
Structurestruct _stat64i32sys/stat.hNoNoNoYesNoNoNoNoDefined as _stat32i64 or _stat64 depending on _USE_32BIT_TIME_T
Structurestruct _stati64sys/stat.hNoNoNoYesNoNoNoNoContains __time64_t for st_atime, st_mtime, and st_ctime
Structurestruct _timebsys/timeb.hNoNoNoYesNoNoNoNoDefined as __timeb32 or __timeb64 depending on _USE32BIT_TIME_T
Structurestruct _utimbufsys/utime.hNoNoNoYesNoNoNoNoContains time_t for access and modification times
Structurestruct itimerspectime.hNoYesYesNoNoYesYesYesContains timespec structs for timer period and expiration
Structurestruct itimervalsys/time.hNoYesYesNoYesNoYesYesContains timeval structs for timer period and expiration
Structurestruct mach_timespecmach/clock_types.hNoNoNoNoYesNoYesNoContains unsigned int for seconds and clock_res_t for nsecs
Structurestruct rusagesys/resource.hNoYesYesNoYesNoYesNoContains timeval structs for user and system time used
Structurestruct statsys/stat.hNoYesYesYesYesYesYesYesContains fields for access, modification, and creation timestime_t for POSIX, Linux, Windows; struct timespec on OSX, unsigned long on VxWorks
Structurestruct stat64sys/stat.hNoNoYesNoYesNoYesYesSame as stat structure
Structurestruct timebsys/timeb.hNoYesYesYesYesNoYesYesContains time_t for time in secs, unsigned short for msecs
Structurestruct timespectime.hYesYesYesNoYesYesYesYesContains fields for seconds and nsecs, time_t for secs, long for nsecs
Structurestruct timevalsys/time.hNoYesYesYesYesYesYesYesContains fields for seconds and usecs, types vary slightly per platformtime_t/suseconds_t on POSIX, Linux, OSX; long/long on Windows, VxWorks
Structurestruct tmtime.hYesYesYesYesYesYesYesYesContains broken out date/time fields each of type intLinux (glibc) and OSX have fields for UTC offset (long) and timezone abbreviation
Structurestruct tmssys/times.hNoYesYesNoYesNoYesYesContains clock_t for process times (user & system for current & children)
Structurestruct utimbufsys/utime.hNoYesYesYesNoNoYesYesContains time_t for access and modification times
Structurestruct utimbuf32sys/utime.hNoNoNoYesNoNoNoNoContains __time32_t for access and modification times
StructureSYSTEMTIMEWindows.hNoNoNoYesNoNoNoNoSpecifies a date and time in UTC or local time
StructureTIME_FIELDSn/aNoNoNoYesNoNoNoNoUndocumented Windows struct
StructureTIME_ZONE_INFORMATIONWindows.hNoNoNoYesNoNoNoNoSpecifies settings for a time zone
StructureTIMECAPSWindows.hNoNoNoYesNoNoNoNoContains timer resolution in min/max msecs in UINT
StructureULARGE_INTEGERWtypes.IdlNoNoNoYesNoNoNoNoA union containing 'ULONGLONG QuadPart' (64-bit unsigned integer), etc.
StructureWIN32_FILE_ATTRIBUTE_DATAWindows.hNoNoNoYesNoNoNoNoReturned by GetFileAttributesEx, contains FILETIMEs for a file
Structurextimethr/xtimec.hNoNoNoYesNoNoNoNoContains time_t for seconds and long for nsecs.
System Clockclock_get_resmach/mach.hNoNoNoNoYesNoNoNoOSX version of clock_getres
System Clockclock_get_timemach/clock.hNoNoNoNoYesNoNoNoOSX version of clock_gettime
System Clockclock_getrestime.hNoYesYesNoNoYesYesYesGets the resolution of a clock to the value in a timespec
System Clockclock_gettimetime.hNoYesYesNoNoYesYesYesGets the current value of a clock in a timespec
System Clockclock_set_resmach/mach.hNoNoNoNoYesNoNoNoOSX version of clock_setres
System Clockclock_set_timemach/clock_priv.hNoNoNoNoYesNoNoNoOSX version of clock_settime
System Clockclock_setrestime.hNoNoNoNoNoYesNoNoSets the resolution of a clock to the value in a timespec
System Clockclock_settimetime.hNoYesYesNoNoYesYesYesSets the current value of a clock in a timespec
System ClocksysAuxClkConnectsysLib.hNoNoNoNoNoYesNoNoConnect callback func to aux clock
System ClocksysAuxClkDisablesysLib.hNoNoNoNoNoYesNoNoDisable aux clock interrupt
System ClocksysAuxClkEnablesysLib.hNoNoNoNoNoYesNoNoEnable aux clock interrupt
System ClocksysAuxClkRateGetsysLib.hNoNoNoNoNoYesNoNoGet the aux clock rate
System ClocksysAuxClkRateSetsysLib.hNoNoNoNoNoYesNoNoSet the aux clock rate
System ClocksysClkConnectsysLib.hNoNoNoNoNoYesNoNoConnect callback func to system clock
System ClocksysClkDisablesysLib.hNoNoNoNoNoYesNoNoDisable the system clock
System ClocksysClkEnablesysLib.hNoNoNoNoNoYesNoNoEnable the system clock
System ClocksysClkRateGetsysLib.hNoNoNoNoNoYesNoNoGet the system clock rate
System ClocksysClkRateSetsysLib.hNoNoNoNoNoYesNoNoSet the system clock rate
Time Calculation_difftime32time.hNoNoNoYesNoNoNoNoVersion of difftime for 32-bit time_t
Time Calculation_difftime64time.hNoNoNoYesNoNoNoNoVersion of difftime for 64-bit time_t
Time CalculationCompareFileTimeWindows.hNoNoNoYesNoNoNoNoCompares two FILETIMEs
Time Calculationdifftimetime.hYesYesYesYesYesYesYesYesCalculates the difference between two time_t values
Time Calculationtimersubsys/time.hNoNoYesNoYesNoYesYesCalculates the difference between two timeval values
Timer/Alarmalarmunistd.hNoYesYesNoYesYesYesYesSchedules an alarm signal
Timer/Alarmgetitimersys/time.hNoYes*YesNoYesNoYesYesGets value of an interval timer in an itimerval structPOSIX.1-2008 marked as obsolete
Timer/AlarmKillTimerWinUser.hNoNoNoNoNoYesNoNoKill a Windows timer
Timer/Alarmsetitimersys/time.hNoYes*YesNoYesNoYesYesSets an interval timer to the value in an itimerval struct POSIX.1-2008 marked as obsolete
Timer/AlarmSetTimerWinUser.hNoNoNoNoNoYesNoNoSet up a Windows timer
Timer/Alarmtimer_canceltimers.hNoNoNoNoNoYesNoNoCancel a timer
Timer/Alarmtimer_connecttimers.hNoNoNoNoNoYesNoNoConnect a callback function to a timer signal
Timer/Alarmtimer_createtime.hNoYesYesNoNoYesYesYesCreate a (per process, real-time) timer
Timer/Alarmtimer_deletetime.hNoYesYesNoNoYesYesYesDelete a (per process, real-time) timer
Timer/Alarmtimer_getoverrunsys/timerfd.hNoYesYesNoNoYesYesYesGets # of expirations since the signal was generated
Timer/Alarmtimer_gettimetime.hNoYesYesNoNoYesYesYesGets time before expiration and interval, times use itimerspec struct
Timer/Alarmtimer_settimetime.hNoYesYesNoNoYesYesYesSets time until next expiration, times use itimerspec structs
Timer/Alarmtimerfd_createsys/timerfd.hNoNoYesNoNoNoNoNoCreate a timer based on a file descriptor
Timer/Alarmtimerfd_gettimesys/timerfd.hNoNoYesNoNoNoNoNoGets current settings for a file descriptor, time is in itimerspec struct
Timer/Alarmtimerfd_settimesys/timerfd.hNoNoYesNoNoNoNoNoStarts or stops a timer for a file descriptor, times are in itimerspec structs
Timer/Alarmualarmunistd.hNoNo*YesNoYesNoYesYesSchedules a signal after given number of usecs in useconds_tPOSIX.1-2001 marked as obsolete, removed in POSIX.1-2008
Timezone_get_daylighttime.hNoNoNoYesNoNoNoNoRetrieves _daylight environment variable
Timezone_get_dstbiastime.hNoNoNoYesNoNoNoNoRetrieves _dstbias environment variable
Timezone_get_timezonetime.hNoNoNoYesNoNoNoNoRetrieves _timezone environment variable
Timezone_get_tznametime.hNoNoNoYesNoNoNoNoRetrieves _tzname environment variable
Timezone_tzsettime.hNoNoNoYesNoNoNoNoSets time-related environment variables
Timezonetimezonetime.hNoNoNoNoYesNoYesYesReturns the timezone abbreviation
Timezonetzsettime.hNoYesYesYesYesNoYesYesSets time-related environment variablesThe link for Windows claims tzset is deprecated in POSIX
Timezonetzsetwalltime.hNoNoNoNoYesNoNoNoHelps localtime return best approx of local wall clock time
Windows Interrupt TimeQueryInterruptTimeRealtimeapiset.hNoNoNoYesNoNoNoNoGets current 'interrupt time' in units of 100 nsecs, including sleep time
Windows Interrupt TimeQueryInterruptTimePreciseRealtimeapiset.hNoNoNoYesNoNoNoNoGets current 'interrupt time' in units of 100 nsecs, including sleep time
Windows Interrupt TimeQueryUnbiasedInterruptTimeRealtimeapiset.hNoNoNoYesNoNoNoNoGets current 'interrupt time' in units of 100 nsecs, not including sleep time
Windows Interrupt TimeQueryUnbiasedInterruptTimePreciseRealtimeapiset.hNoNoNoYesNoNoNoNoGets current 'interrupt time' in units of 100 nsecs, not including sleep time
Windows MM TimertimeBeginPeriodWindows.hNoNoNoYesNoNoNoNorequests a minimum resolution for periodic timers Param for period is UINT, but meaning is unclear
Windows MM TimertimeEndPeriodWindows.hNoNoNoYesNoNoNoNoClears a previously set minimum timer resolutionParam for period is UINT, but meaning is unclear
Windows MM TimertimeGetDevCapsWindows.hNoNoNoYesNoNoNoNoQueries timer device to get resolution, resolution, in TIMECAPS struct
Windows MM TimertimeGetSystemTimeWindows.hNoNoNoYesNoNoNoNoGets the time since the system started in msecs, returned as an MMTIME
Windows MM TimertimeGetTimeWindows.hNoNoNoYesNoNoNoNoGets the time since the system started in msecs, returned as a DWORDRollls over after 49.71 days
Windows MM TimertimeKillEventWindows.hNoNoNoYesNoNoNoNoCancels a timer event
Windows MM TimerTimeProcWindows.hNoNoNoYesNoNoNoNoFunction called at expiration of event(s)
Windows MM TimertimeSetEventWindows.hNoNoNoYesNoNoNoNoConfigures a function called after a delay and resolution in msecs in UINTCan be one-shot or periodic
Windows Perf CounterKeQueryInterruptTimeWdm.hNoNoNoYesNoNoNoNoGets interrupt time count in 100 nsec in LONGLONGFor drivers etc
Windows Perf CounterKeQueryPerformanceCounterWdm.hNoNoNoYesNoNoNoNoGets current value of performance counter and freq in LARGE_INTEGERsFor drivers etc
Windows Perf CounterKeQuerySystemTimeWdm.hNoNoNoYesNoNoNoNoGets system time in 100 sec increments since Jan 1, 1601 in LARGE_INTEGERFor drivers etc
Windows Perf CounterKeQueryTickCountWdm.hNoNoNoYesNoNoNoNoGets # of interval timer interrupts since system booted in LARGE_INTEGERFor drivers etc
Windows Perf CounterKeQueryTimeIncrementWdm.hNoNoNoYesNoNoNoNoGets # of 100 nsecs added to system time on each clock interrupt in LONGFor drivers etc
Windows Perf CounterQueryPerformanceCounterWindows.hNoNoNoYesNoNoNoSim/TestGets current value of performance counter in LARGE_INTEGERFor user apps
Windows Perf CounterQueryPerformanceFrequencyWindows.hNoNoNoYesNoNoNoSim/TestGets performance counter frequency (counts per sec) in LARGE_INTEGERFor user apps
Windows TimerCreateWaitableTimerWindows.hNoNoNoYesNoNoNoNoCreates or opens a waitable timer object
Windows TimerSetWaitableTimerWindows.hNoNoNoYesNoNoNoNoActivates a timer, DueTime is UTC since Jan 1, 1601 in LARGE_INTEGER, period in msecs
Windows TimerSetWaitableTimerExWindows.hNoNoNoYesNoNoNoNoActivates a timer, DueTime is UTC since Jan 1, 1601 in LARGE_INTEGER, period in LONG in msecs, also has TolerableDelay in msecs as ULONG
Windows TimerWaitForSingleObjectWindows.hNoNoNoYesNoNoNoSim/TestWait for an object to be in signaled state or time-out
Windows UndocNtGetTickCountn/aNoNoNoYesNoNoNoNoReturns system timer's tick count as ULONG
Windows UndocNtQueryPerformanceCountern/aNoNoNoYesNoNoNoNoReturns # processor ticks and frequency as LARGE_INTEGERs
Windows UndocNtQuerySystemTimen/aNoNoNoYesNoNoNoNoReturns current time in UTC format in units of 100 nsecs since Jan 1, 1600Rolls over after ~29227.7 years, or August of the year 27627
Windows UndocNtQueryTimerResolutionn/aNoNoNoYesNoNoNoNoGets min, max, and actual timer resolution in 100 nsec units as ULONGHidden API function
Windows UndocNtSetSystemTimen/aNoNoNoYesNoNoNoNoSets system time to given UTC format as LARGE_INTEGERTBD: Verify that epoch is Jan 1, 1600
Windows UndocNtSetTimerResolutionn/aNoNoNoYesNoNoNoNoRequests a timer resolution in 100 nsec units as ULONGHidden API function
Windows UndocRtlTimeFieldsToTimen/aNoNoNoYesNoNoNoNoConverts TIME_FIELDS struct to time in LARGE_INTEGERTBD: Verify that epoch is Jan 1, 1600, and that time is in UTC format
Windows UndocRtlTimeToTimeFieldsn/aNoNoNoYesNoNoNoNoConverts time in LARGE_INTEGER to TIME_FIELDS structTBD: Verify that epoch is Jan 1, 1600, and that time is in UTC format
Windows 'xtime'_Xtime_diff_to_millisthr/xtimec.hNoNoNoYesNoNoNoNoReturns diff between 2 xtime structs, returned as long in msecs
Windows 'xtime'_Xtime_diff_to_millis2thr/xtimec.hNoNoNoYesNoNoNoNoReturns diff between current time and xtime struct, returns long in msecs
Windows 'xtime'_Xtime_get_ticksthr/xtimec.hNoNoNoYesNoNoNoNoGet system time in 100 nsec intervals since the epoch, returned in xtimeAt given link, EPOCH is defined as 0x19DB1DED53E8000i64
Windows 'xtime'xtime_getthr/xtimec.hNoNoNoYesNoNoNoNoGet the current time returned in an xtime struct

Leave a Reply

Your email address will not be published. Required fields are marked *