Wednesday, August 31, 2016

C Library Header – time

The <time.h> header provides several functions useful for reading and converting the current time and date.

The <time.h> header shall define the following macro constant:
CLOCKS_PER_SECnumber of processor clock ticks per second

The <time.h> header shall define the following function:
Time manipulation:
difftimecomputes the difference between times
timereturns the current calendar time of the system as time since epoch
clockreturns raw processor clock time since the program is started
timespec_get returns the calendar time based on a given time base (C11)

Conversion:
asctime
asctime_s(C11)
converts a tm object to a textual representation
ctime
ctime_s(C11)
converts a time_t object to a textual representation
strftimeconverts a tm object to custom textual representation (function)
gmtime
gmtime_s(C11)
converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC)
localtime
localtime_s(C11)
converts time since epoch to calendar time expressed as local time
mktimeconverts calendar time to time since epoch

The <time.h> header shall define the following type:
tmcalendar time type (struct)
time_tcalendar time since epoch type
clock_tprocessor time since era type
timespec time in seconds and nanoseconds (struct)(C11)



Related topics:
<tgmath.h>   |   <threads.h>   |   <uchar.h>   |   <wchar.h>   |   <wctype.h>   |   Standard Library in C

List of topics: C Programming

No comments:

Post a Comment