Date and time utilities

Functions

Time manipulation
Defined in header <time.h>
difftime
computes the difference between times
(function)
time
returns the current calendar time of the system as time since epoch
(function)
clock
returns raw processor clock time since the program is started
(function)
timespec_get
(C11)
returns the calendar time in seconds and nanoseconds based on a given time base
(function)
timespec_getres
(C23)
returns the resolution of calendar time based on a given time base
(function)
Format conversions
Defined in header <time.h>
asctimeasctime_s
(deprecated in C23)(C11)
converts a tm object to a textual representation
(function)
ctimectime_s
(deprecated in C23)(C11)
converts a time_t object to a textual representation
(function)
strftime
converts a tm object to custom textual representation
(function)
Defined in header <wchar.h>
wcsftime
(C95)
converts a tm object to custom wide string textual representation
(function)
Defined in header <time.h>
gmtimegmtime_rgmtime_s
(C23)(C11)
converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC)
(function)
localtimelocaltime_rlocaltime_s
(C23)(C11)
converts time since epoch to calendar time expressed as local time
(function)
mktime
converts calendar time to time since epoch
(function)

Constants

Defined in header <time.h>
CLOCKS_PER_SEC
number of processor clock ticks per second
(macro constant)

Types

Defined in header <time.h>
tm
calendar time type
(struct)
time_t
calendar time since epoch type
(typedef)
clock_t
processor time since era type
(typedef)
timespec
(C11)
time in seconds and nanoseconds
(struct)

References

See also

C++ documentation for C Date and time utilities

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/c/chrono