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 OSXVxWorksDescription
Constant/Definition _USE_32BIT_TIME_Tn/aNoNoNoYesNoNoOn 64-bit Windows, forces time_t to 32-bits
Constant/Definition__DARWIN_CLK_TCKi386/_limits.hNoNoNoNoYes (100)NoCLOCKS_PER_SECOND when __DARWIN_UNIX03 not defined
Constant/Definition_POSIX_TZNAME_MAXlimits.hNoYesNoNoYesYesMax length of the tzname variable
Constant/Definition_SC_CLK_TCKunistd.hNoYesYesNoYesNoThe system clock rate in ticks per sec
Constant/Definition_XTIME_NSECS_PER_TICKthr/xtimec.hNoNoNoYesNoNo# nsecs per tick (as related to xtime), defined as 100
Constant/Definition_XTIME_TICKS_PER_TIME_Tthr/xtimec.hNoNoNo10MNoNo# ticks per sec (as related to xtime), defined as 10M (__LONGLONG)
Constant/DefinitionCLK_TCKVariesNoNo*Yes*YesYesNoThe system clock rate in ticks per sec (* = marked as obsolete)
Constant/DefinitionCLOCKS_PER_SECtime.hYes1M1M10001M or 100sysClockRateGetThe system clock rate in ticks per sec
Constant/DefinitionTZNAME_MAXlimits.hNoYesYesYesNoNoMax length of the tzname variable
CPU Usageclocktime.hYesYesYesYesYesYesGets the CPU time used, returned in a clock_t
CPU Usagegetrusagesys/resource.hNoYesYesNoYesNoGets info about resource utilization, returned in rusage structure
Current Time_ftimesys/timeb.hNoNoNoYesNoNoGets current time in secs by calling _ftime32 or _ftime64
Current Time_ftime_ssys/timeb.hNoNoNoYesNoNoGets current time in secs by calling _ftime32_s or ftime64_s
Current Time_ftime32sys/timeb.hNoNoNoYesNoNoGets current time in secs from Jan 1, 1970, limited to Jan 19, 2038
Current Time_ftime32_ssys/timeb.hNoNoNoYesNoNoGets current time in secs from Jan 1, 1970, limited to Jan 19, 2038
Current Time_ftime64sys/timeb.hNoNoNoYesNoNoGets current time in secs from Jan 1, 1970, limited to Dec 31, 3000
Current Time_ftime64_ssys/timeb.hNoNoNoYesNoNoGets current time in secs from Jan 1, 1970, limited to Dec 31, 3001
Current Time_time32time.hNoNoNoYesNoNoWindows function for getting time in 32-bit time_t
Current Time_time64time.hNoNoNoYesNoNoWindows function for getting time in 64-bit time_t
Current Timeftimesys/timeb.hNoNo*YesYesYesNoGets current time in secs and msecs since epoch of Jan 1, 1970 as timeb
Current TimeGetDynamicTimeZoneInformationWindows.hNoNoNoYesNoNoReturns the current timezone and dynamic DST settings
Current TimeGetFileAttributesExWindows.hNoNoNoYesNoNoReturns various data including FILETIMEs for create, write, and access
Current TimeGetFileTimeWindows.hNoNoNoYesNoNoReturns the (creation, last access, and last write) times for a file or folder
Current TimeGetLocalTimeWindows.hNoNoNoYesNoNoGets the current system time (local time format), in a SYSTEMTIME struct
Current TimeGetSystemTimeWindows.hNoNoNoYesNoNoGets the current system time (UTC format), in SYSTEMTIME struct
Current TimeGetSystemTimeAdjustmentWindows.hNoNoNoYesNoNoGets system clock adjustments, 100 nsec units in DWORD
Current TimeGetSystemTimeAsFileTimeWindows.hNoNoNoYesNoNoGets accurate system time in UTC format as a FILETIME
Current TimeGetSystemTimePreciseAsFileTimeWindows.hNoNoNoYesNoNoGets accurate system time in UTC format as a FILETIME
Current TimeGetSystemTimesWindows.hNoNoNoYesNoNoGets idle, kernel, and user times in FILETIME structs
Current TimeGetTickCountWindows.hNoNoNoYesNoNoGets # of msecs since system start, rolls over after 49.7 days
Current TimeGetTickCount64Windows.hNoNoNoYesNoNoGets # of msecs since system start, with resolution of 10-16 msecs
Current Timegettimeofdaysys/time.hNoYes*YesNoYesNoGets current date/time as a timeval struct
Current TimeSetDynamicTimeZoneInformationWindows.hNoNoNoYesNoNoSets the current timezone and dynamic DST settings
Current TimeSetFileTimeWindows.hNoNoNoYesNoNoSets the (creation, last access, and last write) times for a file or folder
Current TimeSetLocalTimeWindows.hNoNoNoYesNoNoSets the current local date and time
Current TimeSetSystemTimeWindows.hNoNoNoYesNoNoSets the current system time using SYSTEMTIME struct with UTC
Current TimeSetSystemTimeAdjustmentWindows.hNoNoNoYesNoNoControls periodic adjustments to system clock, 100 nsec units in DWORD
Current Timesettimeofdaysys/time.hNoNoYesNoYesNoSets current system time based on value in timeval struct
Current Timestimetime.hNoNoYesNoNoNoSets current system time based on value in time_t
Current Timetimetime.hYesYesYesYesYesYesGets time since epoch in a time_t
Env Variable_daylightn/aNoNoNoYesNoNoNonzero if DST is specified in TZ or determined from the OS, otherwise 0
Env Variable_dstbiasn/aNoNoNoYesNoNoDifference between standard and DST in seconds
Env Variable_timezonen/aNoNoNoYesNoNoDifference between UTC and local time in seconds
Env Variable_tzname[0]n/aNoNoNoYesNoNoNon-DST zone name derived from TZ, e.g. "PST"
Env Variable_tzname[1]n/aNoNoNoYesNoNoDST zone name derived from TZ, e.g. "PDT"
Env VariableDATEn/aNoNoNoYesNoNoHolds the current date, e.g. "Fri 12/25/2015"
Env VariableDATEMSKn/aNoYesYesNoYesNoIndicates the pathname of the template file used by getdate()
Env VariableHZn/aNoNoYesNoNoNoTells # of timer interrupts per second, infrequently used
Env VariableTIMEn/aNoNoNoYesNoNoHolds the current time, e.g. "23:42:49.56"
Env VariableTIMEZONEn/aNoNoNoNoNoYesRepresents timezone information
Env VariableTZn/aNoYesYesYesYesNoRepresents timezone information
Env VariableTZDIRn/aNoNoYesNoNoNoUsed by glibc to specify an alternate timezone information file
File System_fstatsys/stat.hNoNoNoYesYesNoGets info about open file, using _stat struct
File System_fstat32sys/stat.hNoNoNoYesNoNoGets info about open file, using _stat32 struct
File System_fstat32i64sys/stat.hNoNoNoYesNoNoGets info about open file, using _stat32i64 struct
File System_fstat64sys/stat.hNoNoNoYesNoNoGets info about open file, using __stat64 struct
File System_fstat64i32sys/stat.hNoNoNoYesNoNoGets info about open file, using _stat64i32 struct
File System_fstati64sys/stat.hNoNoNoYesNoNoGets info about open file, using _stati64 struct
File System_futimesys/utime.hNoNoNoYesNoNoSets mod time on open file, using _utimbuf struct
File System_futime32sys/utime.hNoNoNoYesNoNoSets mod time on open file, using _utimbuf32 struct
File System_futime64sys/utime.hNoNoNoYesNoNoSets mod time on open file, using _utimbuf64 struct
File System_statsys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat struct
File System_stat32sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat32 struct
File System_stat32i64sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat32i64 struct
File System_stat64sys/stat.hNoNoNoYesNoNoGets info about a file, returned as __stat64 struct
File System_stat64i32sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat64i32 struct
File System_stati64sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stati64 struct
File System_utimesys/utime.hNoNoNoYesNoNoSets mod time on file, using _utimbuf struct
File System_utime32sys/utime.hNoNoNoYesNoNoSets mod time on file, using _utimbuf32 struct
File System_utime64sys/utime.hNoNoNoYesNoNoSets mod time on file, using _utimbuf64 struct
File System_wstatsys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat struct
File System_wstat32sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat32 struct
File System_wstat32i64sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat32i64 struct
File System_wstat64sys/stat.hNoNoNoYesNoNoGets info about a file, returned as __stat64 struct
File System_wstat64i32sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stat64i32 struct
File System_wstati64sys/stat.hNoNoNoYesNoNoGets info about a file, returned as _stati64 struct
File System_wutimesys/utime.hNoNoNoYesNoNoSets mod time on file, using _utimbuf struct
File System_wutime32sys/utime.hNoNoNoYesNoNoSets mod time on file, using _utimbuf32 struct
File System_wutime64sys/utime.hNoNoNoYesNoNoSets mod time on file, using _utimbuf64 struct
File Systemfstatsys/stat.hNoYesYesYesYesYesGets info about open file, returned in stat struct
File Systemfstat64sys/stat.hNoNoNoNoYesNoGets info about open file, returned in stat64 struct
File Systemfstatatsys/stat.hNoYesYesYesYesNoGet info about an open file relative to given path, returned in stat struct
File Systemfstatat64sys/stat.hNoNoNoNoYesNoGet info about an open file relative to given path, returned in stat64 struct
File SystemGetFileTimeWindows.hNoNoNoYesNoNoGets create, last write, and last access times for file opened with CreateFile
File Systemlstatsys/stat.hNoYesYesNoYesNoGets info about a symbolic link, returned in stat struct
File Systemlstat64sys/stat.hNoNoYesNoYesNoGets info about a symbolic link, returned in stat64 struct
File Systemstatsys/stat.hNoYesYesYesYesYesGets info about a file, returned in stat struct
File Systemstat64sys/stat.hNoNoNoNoYesNoGets info about a file, returned in stat64 struct
File Systemutimeutime.hNoYesYesYesYesYesSet file access and mod times, using utimbuf struct
Format Conv_ctime32time.hNoNoNoYesNoNoConvert a time32_t to a date/time string
Format Conversion_ctime32_stime.hNoNoNoYesNoNoConvert a time32_t to a date/time string
Format Conversion_ctime64time.hNoNoNoYesNoNoConvert a time64_t to a date/time string
Format Conversion_ctime64_stime.hNoNoNoYesNoNoConvert a time64_t to a date/time string
Format Conversion_gmtime32time.hNoNoNoYesNoNoConvert a time32_t to a tm struct
Format Conversion_gmtime32_stime.hNoNoNoYesNoNoConvert a time32_t to a tm struct
Format Conversion_gmtime64time.hNoNoNoYesNoNoConvert a time64_t to a tm struct
Format Conversion_gmtime64_stime.hNoNoNoYesNoNoConvert a time64_t to a tm struct
Format Conversion_localtime32time.hNoNoNoYesNoNoConvert a time32_t to a tm struct, adjusting for time zone
Format Conversion_localtime32time.hNoNoNoYesNoNoVersion of localtime for 32-bit time_t
Format Conversion_localtime32_stime.hNoNoNoYesNoNoConvert a time32_t to a tm struct, adjusting for time zone
Format Conversion_localtime64time.hNoNoNoYesNoNoConvert a time64_t to a tm struct, adjusting for time zone
Format Conversion_localtime64time.hNoNoNoYesNoNoVersion of localtime for 64-bit time_t (valid until Dec 31, 3000)
Format Conversion_localtime64_stime.hNoNoNoYesNoNoConvert a time64_t to a tm struct, adjusting for time zone
Format Conversion_mkgmtimetime.hNoNoNoYesNoNoConvert a UTC time in a tm struct to a UTC time in a time_t
Format Conversion_mkgmtime32time.hNoNoNoYesNoNoConvert a UTC time in a tm struct to a UTC time in a time32_t
Format Conversion_mkgmtime64time.hNoNoNoYesNoNoConvert a UTC time in a tm struct to a UTC time in a time64_t
Format Conversion_mktime32time.hNoNoNoYesNoNoConvert a local time in tm struct to a time32_t
Format Conversion_mktime64time.hNoNoNoYesNoNoConvert a local time in tm struct to a time64_t
Format Conversion_strdatetime.hNoNoNoYesNoNoCopies the current system date to a buffer in format DD/MM/YY
Format Conversion_strdate_stime.hNoNoNoYesNoNoCopies the current system date to a buffer in format DD/MM/YY
Format Conversion_strftime_ltime.hNoNoNoYesNoNoConvert a time in a tm struct to a string using a specified format and locale
Format Conversion_strtimetime.hNoNoNoYesNoNoCopied the current system time to a buffer in format HH:MM:SS
Format Conversion_strtime_stime.hNoNoNoYesNoNoCopied the current system time to a buffer in format HH:MM:SS
Format Conversion_tstrdatetchar.hNoNoNoYesNoNoSame as _wstrdate
Format Conversion_tstrdate_stchar.hNoNoNoYesNoNoSame as _wstrdate_s
Format Conversion_tstrtimetchar.hNoNoNoYesNoNoSame as _wstrtime
Format Conversion_tstrtime_stchar.hNoNoNoYesNoNoSame as _wstrtime_s
Format Conversion_wasctime_stime.hNoNoNoYesNoNoConvert a tm struct to a string
Format Conversion_wcsftime_lwchar.hNoNoNoYesNoNoConvert time in tm struct to wide char string using a specified format and locale
Format Conversion_wctimetime.h or wchar.hNoNoNoYesNoNoConvert a time_t to a wide date/time string
Format Conversion_wctime_stime.h or wchar.hNoNoNoYesNoNoConvert a time_t to a wide date/time string
Format Conversion_wctime32time.h or wchar.hNoNoNoYesNoNoConvert a time32_t to a wide date/time string
Format Conversion_wctime32_stime.h or wchar.hNoNoNoYesNoNoConvert a time32_t to a wide date/time string
Format Conversion_wctime64time.h or wchar.hNoNoNoYesNoNoConvert a time64_t to a wide date/time string
Format Conversion_wctime64_stime.h or wchar.hNoNoNoYesNoNoConvert a time64_t to a wide date/time string
Format Conversion_wstrdatetime.hNoNoNoYesNoNoThe wide-character version of _strdate
Format Conversion_wstrdate_stime.hNoNoNoYesNoNoThe wide-character version of _strdate_s
Format Conversion_wstrtimetime.hNoNoNoYesNoNoThe wide-character version of _strtime
Format Conversion_wstrtime_stime.hNoNoNoYesNoNoThe wide-character version of _strtime_s
Format Conversionasctimetime.hYesYesYesYesYesYesConvert a date/time in a tm struct to a string
Format Conversionasctime_rtime.hNoYesYesNoYesYesConvert a date/time in a tm struct to a string
Format Conversionasctime_stime.hYesNoNoYesYesNoConvert a tm struct to a string
Format Conversionctimetime.hYesYesYesYesYesYesConvert a time_t to a date/time string
Format Conversionctime_rtime.hNoYesYesNoYesYesConvert a time_t to a date/time string
Format Conversionctime_stime.hYesNoNoYesNoNoConvert a time_t to a date/time string
Format ConversionDosDateTimeToFileTimeWindows.hNoNoNoYesNoNoConvert MSDOS date/time to FILETIME
Format ConversionExLocalTimeToSystemTimeWdm.hNoNoNoYesNoNoConvert system time for current time zone to unbiased GMT
Format ConversionExSystemTimeToLocalTimeWdm.hNoNoNoYesNoNoConvert GMT system time to local system time for current time zone
Format ConversionFileTimeToDosDateTimeWindows.hNoNoNoYesNoNoConvert FILETIME to MSDOS date/time
Format ConversionFileTimeToLocalFileTimeWindows.hNoNoNoYesNoNoConvert a UTC-based FILETIME to a local time-based FILETIME
Format ConversionFileTimeToSystemTimeWindows.hNoNoNoYesNoNoConvert a FILETIME to a SYSTEMTIME (broken out, UTC-based)
Format Conversiongetdatetime.hNoYesYesNoYesNoConverts date/time string to struct tm
Format Conversiongetdate_rtime.hNoNoYesNoNoNoGNU re-entrant version of getdate
Format Conversiongmtimetime.hYesYesYesYesYesYesConvert a time_t to a tm struct
Format Conversiongmtime_rtime.hNoYesYesNoYesYesConvert a time_t to a tm struct
Format Conversiongmtime_stime.hYesNoNoYesNoNoConvert a time_t to a tm struct
Format ConversionLocalFileTimeToFileTimeWindows.hNoNoNoYesNoNoConvert a local FILETIME to a FILETIME based on UTC
Format Conversionlocaltimetime.hYesYesYesYesYesYesConvert a time_t to a tm struct, adjusting for time zone
Format Conversionlocaltime_rtime.hNoYesYesNoYesYesConvert a time_t to a tm struct, adjusting for time zone
Format Conversionlocaltime_stime.hYesNoNoYesNoNoConvert a time_t to a tm struct, adjusting for time zone
Format Conversionmktimetime.hYesYesYesYesYesYesConvert a local time in tm struct to a time_t
Format ConversionRtlLocalTimeToSystemTimeWindows.hNoNoNoYesNoNoConvert local time in LARGE_INTEGER to system time in LARGE_INTEGER
Format ConversionRtlTimeToSecondsSince1970Windows.hNoNoNoYesNoNoConvert system time in LARGE_INTEGER to # seconds since 1970 in ULONG
Format Conversionstrftimetime.hYesYesYesYesYesYesConvert a time in a tm struct to a string using a specified format
Format Conversionstrftime_ltime.hNoNoNoNoYesNoConvert a time in a tm struct to a string using a specified format and locale
Format Conversionstrptimetime.hNoYesYesNoYesNoConvert a string containing date/time to a tm struct using a given format
Format Conversionstrptime_ltime.hNoNoNoNoYesNoConvert a string containing date/time to a tm struct using a given format and locale
Format ConversionSystemTimeToFileTimeWindows.hNoNoNoYesNoNoConvert time in a SYSTEMTIME struct (in UTC) to a FILETIME
Format ConversionSystemTimeToTzSpecificLocalTimeWindows.hNoNoNoYesNoNoConvert UTC tie in SYSTEMTIME struct to SYSTEMTIME in specified time zone
Format ConversionSystemTimeToTzSpecificLocalTimeExWindows.hNoNoNoYesNoNoConvert UTC tie in SYSTEMTIME struct to SYSTEMTIME in specified time zone
Format Conversiontimegmtime.hNoNoYesNoYesNoConvert a UTC-based time in tm struct to a time_t
Format Conversiontimelocaltime.hNoNoYesNoYesNoConvert a local time in tm struct to a time_t (Equivalent of mktime)
Format ConversionTzSpecificLocalTimeToSystemTimeWindows.hNoNoNoYesNoNoConvert a local time in SYSTEMTIME to a UTC time also in SYSTEMTIME
Format ConversionTzSpecificLocalTimeToSystemTimeExWindows.hNoNoNoYesNoNoConvert a local time in SYSTEMTIME to a UTC time also in SYSTEMTIME
Format Conversionwcsftimewchar.hYesYesYesYesYesNoConvert a time in a tm struct to a wide char string using a specified format
Global Variabledaylighttime.hNoYesYesYesYesNoSet to 0 to disable DST conversions
Global Variabletimezonetime.hNoYesYesYesYesNoThe difference in seconds between UTC and local standard time
Global Variabletzname[0]time.hNoYesYesYesYesNoThe string for local standard time (without DST), e.g. "EST"
Global Variabletzname[1]time.hNoYesYesYesYesNoThe string for local daylight time (with DST), e.g. "EDT"
Macro__DATE__N/AYesNoYesYesYesYesString of the current date in the form "Mmm dd yyyy"
Macro__TIME__N/AYesNoYesYesYesYesString of the current time in the form "hh:mm:ss"
MacroLC_TIMElocale.hYesYesYesYesYesYesUsed for formatting date and time values with strftime
Msg Queuemq_timedreceivemqueue.hNoYesYesNoNoYesRcv a msg from a msg queue, wait max of absolute time in timespec struct
Msg Queuemq_timedsendmqueue.hNoYesYesNoNoYesSend a msg from a msg queue, wait max of absolute time in timespec struct
Simple Type__darwin_suseconds_tsys/_types.hNoNoNoNoYesNoA 32-bit signed integer representing usecs
Simple Type__darwin_time_ti386/_types.hNoNoNoNoYesNoApple's time_t (defined as 'long')
Simple Type__darwin_useconds_tsys/_types.hNoNoNoNoYesNoA 32-bit unsigned integer representing usecs
Simple Type__int64variesNoNoYesYesYesNoA signed 64-bit signed integer
Simple Type__suseconds_tbits/types.hNoNoYesNoNoNoA 32-bit signed integer representing usecs
Simple Type__time32_ttime.hNoNoNoYesNoNoA 32-bit signed integer (defined as long which is 32-bits on Windows)
Simple Type__time64_ttime.hNoNoNoYesNoNoA 64-bit signed integer (defined as __int64)
Simple Type__useconds_tbits/types.hNoNoYesNoNoNoA 32-bit unsigned integer representing usecs
Simple Typeclock_res_tmach/clock_types.hNoNoNoNoYesNoDefined as int
Simple Typeclock_tVariesYesYesYesYesYesYeslong on Linux and Windows, unsigned long on OSX, and unsigned int on VxWorks
Simple TypeDWORDVariesNoNoYesYesYesYesA 32-bit unsigned integer
Simple TypeINTSeveralNoNoNoYesNoNoSame as int
Simple Typeintn/aYesYesYesYesYesYesA signed integer; check platform for actual size
Simple TypeLONGSeveralNoNoNoYesNoYesSame as long (32-bits on all Windows)
Simple Typelongn/aYesYesYesYesYesYesA signed integer; check platform for actual size
Simple Typelong longn/aYesYesYesYesYesYesA signed 64-bit integer
Simple TypeLONGLONGSeveralNoNoNoYesNoYesSame as long long (64-bits)
Simple Typesize_tstddef.hYesYesYesYesYesYesDefined as unsigned int on VxWorks
Simple Typesuseconds_tsys/types.hNoYesYesNoYesNoA 32-bit signed integer representing usecs
Simple Typetime_ttime.hYesYesYesYesYesYesSecs since epoch; long on Linux and OSX, __time32_t or __time64_t on Windows, unsigned long on VxWorks for 32-bit systems
Simple TypeUINTSeveralNoNoNoYesNoNoSame as unsigned int
Simple TypeULONGSeveralNoNoNoYesNoYesSame as unsigned long (32-bits on all Windows)
Simple TypeULONGLONGSeveralNoNoNoYesNoYesSame as unsigned long long (64-bits)
Simple Typeunsigned intn/aYesYesYesYesYesYesAn unsigned integer; check platform for actual size
Simple Typeunsigned longn/aYesYesYesYesYesYesAn unsigned integer; check platform for actual size
Simple Typeunsigned long longn/aYesYesYesYesYesYesAn unsigned 64-bit integer
Simple Typeuseconds_tsys/types.hNoYesYesNoYesNoA 32-bit unsigned integer representing usecs
Sleep Func_sleepstdlib.hNoNoNoYesNoNoSleep for given # of (units unknown), in unsigned long
Sleep Func_Thrd_sleepthr/xthreads.hNoNoNoYesNoNoSleep unti an absolute time given in an xtime
Sleep Funcclock_nanosleeptime.hNoYesYesNoNoYesSleep until an absolute time or relative time given in a timespec struct
Sleep Funcnanosleeptime.hNoYesYesNoYesYesSleep for given # of nanoseconds given in a timespec struct
Sleep Funcsleepunistd.hNoYesYesNoYesYesSleep for given # of seconds in unsigned int
Sleep Funcsleepthr/threadNoNoNoYesNoNoSleep until the absolute time given in an xtime
Sleep FuncSleepWindows.hNoNoNoYesNoNoSleep for given # of msecs in a DWORD
Sleep Funcsleep_forthreadNoNoNoYesNoNoSleep until a relative time
Sleep Funcsleep_untilthreadNoNoNoYesNoNoSleep until an absolute time
Sleep Functhrd_sleepthr/threads.hYesNoNoYesNoNoSleep until an absolute time given in an xtime
Sleep Funcusleepunistd.hNoNo*YesNoYesNoSleep for given # of usecs, in a useconds_t
StructureDYNAMIC_TIME_ZONE_INFORMATIONWindows.hNoNoNoYesNoNoSpecifies settings for a time zone and dynamic daylight saving time
StructureFILETIMEWindows.hNoNoNoYesNoNoContains 2 DWORDs for time since Jan 1, 1601 in units of 100 nsecs
StructureLARGE_INTEGERWtypes.IdlNoNoNoYesNoNoA union containing 'LONGLONG QuadPart' (64-bit signed integer), etc
Structuremach_timespec_tmach/clock_types.hNoNoNoNoYesNoContains unsigned int for seconds and (signed) int for nsecs
StructureMMTIMEWindows.hNoNoNoYesNoNoContains timing information on various types of multimedia data
Structurestruct __stat64sys/stat.hNoNoNoYesNoNoSame as _stat64
Structurestruct __timeb32sys/timeb.hNoNoNoYesNoNoContains __time32_t for time in secs, unsigned short for msecs
Structurestruct __timeb64sys/timeb.hNoNoNoYesNoNoContains __time64_t for time in secs, unsigned short for msecs
Structurestruct __utimbuf32sys/utime.hNoNoNoYesNoNoContains __time32_t for access and modification times
Structurestruct __utimbuf64sys/utime.hNoNoNoYesNoNoContains __time64_t for access and modification times
Structurestruct _statsys/stat.hNoNoNoYesNoNoDefined as _stat32 or _stat64i32 depending on _USE_32BIT_TIME_T
Structurestruct _stat32sys/stat.hNoNoNoYesNoNoContains __time32_t for st_atime, st_mtime, and st_ctime
Structurestruct _stat32i64sys/stat.hNoNoNoYesNoNoContains __time32_t for st_atime, st_mtime, and st_ctime
Structurestruct _stat64i32sys/stat.hNoNoNoYesNoNoDefined as _stat32i64 or _stat64 depending on _USE_32BIT_TIME_T
Structurestruct _stati64sys/stat.hNoNoNoYesNoNoContains __time64_t for st_atime, st_mtime, and st_ctime
Structurestruct _timebsys/timeb.hNoNoNoYesNoNoDefined as __timeb32 or __timeb64 depending on _USE32BIT_TIME_T
Structurestruct _utimbufsys/utime.hNoNoNoYesNoNoContains time_t for access and modification times
Structurestruct itimerspectime.hNoYesYesNoNoYesContains timespec structs for timer period and expiration
Structurestruct itimervalsys/time.hNoYesYesNoYesNoContains timeval structs for timer period and expiration
Structurestruct mach_timespecmach/clock_types.hNoNoNoNoYesNoContains unsigned int for seconds and clock_res_t for nsecs
Structurestruct rusagesys/resource.hNoYesYesNoYesNoContains timeval structs for user and system time used
Structurestruct statsys/stat.hNoYesYesYesYesYesContains fields for access, modification, and creation times
Structurestruct stat64sys/stat.hNoNoYesNoYesNoSame as stat structure
Structurestruct timebsys/timeb.hNoYesYesYesYesNoContains time_t for time in secs, unsigned short for msecs
Structurestruct timespectime.hYesYesYesNoYesYesContains fields for seconds and nsecs, time_t for secs, long for nsecs
Structurestruct timevalsys/time.hNoYesYesYesYesYesContains fields for seconds and usecs, types vary slightly per platform
Structurestruct tmtime.hYesYesYesYesYesYesContains broken out date/time fields each of type int
Structurestruct tmssys/times.hNoYesYesNoYesNoContains clock_t for process times (user & system for current & children)
Structurestruct utimbufsys/utime.hNoYesYesYesNoNoContains time_t for access and modification times
Structurestruct utimbuf32sys/utime.hNoNoNoYesNoNoContains __time32_t for access and modification times
StructureSYSTEMTIMEWindows.hNoNoNoYesNoNoSpecifies a date and time in UTC or local time
StructureTIME_FIELDSn/aNoNoNoYesNoNoUndocumented Windows struct
StructureTIME_ZONE_INFORMATIONWindows.hNoNoNoYesNoNoSpecifies settings for a time zone
StructureTIMECAPSWindows.hNoNoNoYesNoNoContains timer resolution in min/max msecs in UINT
StructureULARGE_INTEGERWtypes.IdlNoNoNoYesNoNoA union containing 'ULONGLONG QuadPart' (64-bit unsigned integer), etc.
StructureWIN32_FILE_ATTRIBUTE_DATAWindows.hNoNoNoYesNoNoReturned by GetFileAttributesEx, contains FILETIMEs for a file
Structurextimethr/xtimec.hNoNoNoYesNoNoContains time_t for seconds and long for nsecs.
System Clockclock_get_resmach/mach.hNoNoNoNoYesNoOSX version of clock_getres
System Clockclock_get_timemach/clock.hNoNoNoNoYesNoOSX version of clock_gettime
System Clockclock_getrestime.hNoYesYesNoNoYesGets the resolution of a clock to the value in a timespec
System Clockclock_gettimetime.hNoYesYesNoNoYesGets the current value of a clock in a timespec
System Clockclock_set_resmach/mach.hNoNoNoNoYesNoOSX version of clock_setres
System Clockclock_set_timemach/clock_priv.hNoNoNoNoYesNoOSX version of clock_settime
System Clockclock_setrestime.hNoNoNoNoNoYesSets the resolution of a clock to the value in a timespec
System Clockclock_settimetime.hNoYesYesNoNoYesSets the current value of a clock in a timespec
System ClocksysAuxClkConnectsysLib.hNoNoNoNoNoYesConnect callback func to aux clock
System ClocksysAuxClkDisablesysLib.hNoNoNoNoNoYesDisable aux clock interrupt
System ClocksysAuxClkEnablesysLib.hNoNoNoNoNoYesEnable aux clock interrupt
System ClocksysAuxClkRateGetsysLib.hNoNoNoNoNoYesGet the aux clock rate
System ClocksysAuxClkRateSetsysLib.hNoNoNoNoNoYesSet the aux clock rate
System ClocksysClkConnectsysLib.hNoNoNoNoNoYesConnect callback func to system clock
System ClocksysClkDisablesysLib.hNoNoNoNoNoYesDisable the system clock
System ClocksysClkEnablesysLib.hNoNoNoNoNoYesEnable the system clock
System ClocksysClkRateGetsysLib.hNoNoNoNoNoYesGet the system clock rate
System ClocksysClkRateSetsysLib.hNoNoNoNoNoYesSet the system clock rate
Time Calculation_difftime32time.hNoNoNoYesNoNoVersion of difftime for 32-bit time_t
Time Calculation_difftime64time.hNoNoNoYesNoNoVersion of difftime for 64-bit time_t
Time CalculationCompareFileTimeWindows.hNoNoNoYesNoNoCompares two FILETIMEs
Time Calculationdifftimetime.hYesYesYesYesYesYesCalculates the difference between two time_t values
Time Calculationtimersubsys/time.hNoNoYesNoYesNoCalculates the difference between two timeval values
Timer/Alarmalarmunistd.hNoYesYesNoYesYesSchedules an alarm signal
Timer/Alarmgetitimersys/time.hNoYes*YesNoYesNoGets value of an interval timer in an itimerval struct
Timer/AlarmKillTimerWinUser.hNoNoNoNoNoYesKill a Windows timer
Timer/Alarmsetitimersys/time.hNoYes*YesNoYesNoSets an interval timer to the value in an itimerval struct
Timer/AlarmSetTimerWinUser.hNoNoNoNoNoYesSet up a Windows timer
Timer/Alarmtimer_canceltimers.hNoNoNoNoNoYesCancel a timer
Timer/Alarmtimer_connecttimers.hNoNoNoNoNoYesConnect a callback function to a timer signal
Timer/Alarmtimer_createtime.hNoYesYesNoNoYesCreate a (per process, real-time) timer
Timer/Alarmtimer_deletetime.hNoYesYesNoNoYesDelete a (per process, real-time) timer
Timer/Alarmtimer_getoverrunsys/timerfd.hNoYesYesNoNoYesGets # of expirations since the signal was generated
Timer/Alarmtimer_gettimetime.hNoYesYesNoNoYesGets time before expiration and interval, times use itimerspec struct
Timer/Alarmtimer_settimetime.hNoYesYesNoNoYesSets time until next expiration, times use itimerspec structs
Timer/Alarmtimerfd_createsys/timerfd.hNoNoYesNoNoNoCreate a timer based on a file descriptor
Timer/Alarmtimerfd_gettimesys/timerfd.hNoNoYesNoNoNoGets current settings for a file descriptor, time is in itimerspec struct
Timer/Alarmtimerfd_settimesys/timerfd.hNoNoYesNoNoNoStarts or stops a timer for a file descriptor, times are in itimerspec structs
Timer/Alarmualarmunistd.hNoNo*YesNoYesNoSchedules a signal after given number of usecs in useconds_t
Timezone_get_daylighttime.hNoNoNoYesNoNoRetrieves _daylight environment variable
Timezone_get_dstbiastime.hNoNoNoYesNoNoRetrieves _dstbias environment variable
Timezone_get_timezonetime.hNoNoNoYesNoNoRetrieves _timezone environment variable
Timezone_get_tznametime.hNoNoNoYesNoNoRetrieves _tzname environment variable
Timezone_tzsettime.hNoNoNoYesNoNoSets time-related environment variables
Timezonetimezonetime.hNoNoNoNoYesNoReturns the timezone abbreviation
Timezonetzsettime.hNoYesYesYesYesNoSets time-related environment variables
Timezonetzsetwalltime.hNoNoNoNoYesNoHelps localtime return best approx of local wall clock time
Windows Interrupt TimeQueryInterruptTimeRealtimeapiset.hNoNoNoYesNoNoGets current 'interrupt time' in units of 100 nsecs, including sleep time
Windows Interrupt TimeQueryInterruptTimePreciseRealtimeapiset.hNoNoNoYesNoNoGets current 'interrupt time' in units of 100 nsecs, including sleep time
Windows Interrupt TimeQueryUnbiasedInterruptTimeRealtimeapiset.hNoNoNoYesNoNoGets current 'interrupt time' in units of 100 nsecs, not including sleep time
Windows Interrupt TimeQueryUnbiasedInterruptTimePreciseRealtimeapiset.hNoNoNoYesNoNoGets current 'interrupt time' in units of 100 nsecs, not including sleep time
Windows MM TimertimeBeginPeriodWindows.hNoNoNoYesNoNorequests a minimum resolution for periodic timers
Windows MM TimertimeEndPeriodWindows.hNoNoNoYesNoNoClears a previously set minimum timer resolution
Windows MM TimertimeGetDevCapsWindows.hNoNoNoYesNoNoQueries timer device to get resolution, resolution, in TIMECAPS struct
Windows MM TimertimeGetSystemTimeWindows.hNoNoNoYesNoNoGets the time since the system started in msecs, returned as an MMTIME
Windows MM TimertimeGetTimeWindows.hNoNoNoYesNoNoGets the time since the system started in msecs, returned as a DWORD
Windows MM TimertimeKillEventWindows.hNoNoNoYesNoNoCancels a timer event
Windows MM TimerTimeProcWindows.hNoNoNoYesNoNoFunction called at expiration of event(s)
Windows MM TimertimeSetEventWindows.hNoNoNoYesNoNoConfigures a function called after a delay and resolution in msecs in UINT
Windows Perf CounterKeQueryInterruptTimeWdm.hNoNoNoYesNoNoGets interrupt time count in 100 nsec in LONGLONG
Windows Perf CounterKeQueryPerformanceCounterWdm.hNoNoNoYesNoNoGets current value of performance counter and freq in LARGE_INTEGERs
Windows Perf CounterKeQuerySystemTimeWdm.hNoNoNoYesNoNoGets system time in 100 sec increments since Jan 1, 1601 in LARGE_INTEGER
Windows Perf CounterKeQueryTickCountWdm.hNoNoNoYesNoNoGets # of interval timer interrupts since system booted in LARGE_INTEGER
Windows Perf CounterKeQueryTimeIncrementWdm.hNoNoNoYesNoNoGets # of 100 nsecs added to system time on each clock interrupt in LONG
Windows Perf CounterQueryPerformanceCounterWindows.hNoNoNoYesNoNoGets current value of performance counter in LARGE_INTEGER
Windows Perf CounterQueryPerformanceFrequencyWindows.hNoNoNoYesNoNoGets performance counter frequency (counts per sec) in LARGE_INTEGER
Windows TimerCreateWaitableTimerWindows.hNoNoNoYesNoNoCreates or opens a waitable timer object
Windows TimerSetWaitableTimerWindows.hNoNoNoYesNoNoActivates a timer, DueTime is UTC since Jan 1, 1601 in LARGE_INTEGER, period in msecs
Windows TimerSetWaitableTimerExWindows.hNoNoNoYesNoNoActivates 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.hNoNoNoYesNoNoWait for an object to be in signaled state or time-out
Windows UndocNtGetTickCountn/aNoNoNoYesNoNoReturns system timer's tick count as ULONG
Windows UndocNtQueryPerformanceCountern/aNoNoNoYesNoNoReturns # processor ticks and frequency as LARGE_INTEGERs
Windows UndocNtQuerySystemTimen/aNoNoNoYesNoNoReturns current time in UTC format in units of 100 nsecs since Jan 1, 1600
Windows UndocNtQueryTimerResolutionn/aNoNoNoYesNoNoGets min, max, and actual timer resolution in 100 nsec units as ULONG
Windows UndocNtSetSystemTimen/aNoNoNoYesNoNoSets system time to given UTC format as LARGE_INTEGER
Windows UndocNtSetTimerResolutionn/aNoNoNoYesNoNoRequests a timer resolution in 100 nsec units as ULONG
Windows UndocRtlTimeFieldsToTimen/aNoNoNoYesNoNoConverts TIME_FIELDS struct to time in LARGE_INTEGER
Windows UndocRtlTimeToTimeFieldsn/aNoNoNoYesNoNoConverts time in LARGE_INTEGER to TIME_FIELDS struct
Windows 'xtime'_Xtime_diff_to_millisthr/xtimec.hNoNoNoYesNoNoReturns diff between 2 xtime structs, returned as long in msecs
Windows 'xtime'_Xtime_diff_to_millis2thr/xtimec.hNoNoNoYesNoNoReturns diff between current time and xtime struct, returns long in msecs
Windows 'xtime'_Xtime_get_ticksthr/xtimec.hNoNoNoYesNoNoGet system time in 100 nsec intervals since the epoch, returned in xtime
Windows 'xtime'xtime_getthr/xtimec.hNoNoNoYesNoNoGet the current time returned in an xtime struct