C++ Standard Library C++ STL Library

C++ - <ctime> (time.h)

The C++ <ctime> header defines several functions, types and macros to get and manipulate date and time information. These types and macros are available to use in a current program after including the header file using - #include <ctime> or #include <time.h>. All types and macros of this header file are listed below:

Library Functions

Time manipulation functions

clock() Returns raw processor clock time since the program is started.
difftime() Returns difference between two times.
time() Returns the current time.

Format conversion functions

asctime() Converts tm structure to a textual representation.
ctime() Converts time_t value to a textual representation.
gmtime() Converts time_t value into calendar time, expressed in UTC time.
localtime() Converts time_t value into calendar time, expressed in local time.

Library Types

clock_t Process running time.
size_t Unsigned integer type.
time_t Time type.
tm Time structure.

Library Macros

Macro constants

CLOCKS_PER_SEC Number of processor clock ticks per second.
NULL Null pointer.