Date and Time: time.h

The time.h header file defines two macros. The first, also defined in many other header files, is NULL, representing the null pointer. The second macro is CLOCKS_PER_SEC; dividing the value returned by clock() by this macro yields time in seconds.

The header file defines the types listed in Table F.17.

Table F.17. Types defined in time.h.
TypeDescription
size_tThe integer type returned by the sizeof operator.
clock_tAn arithmetic type suitable to represent time.
time_tAn arithmetic type suitable to represent time.
struct tmA structure type for holding components of calendar time.

The components of the calendar type are referred to as broken-down time. Table F.18 lists the required members of a struct tm structure.

Table F.18. ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.