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:
Functions | Description |
clock() |
Returns raw processor clock time since the program is started. |
difftime() |
Returns difference between two times. |
mktime() |
Converts tm structure to time_t. |
time() |
Returns the current time. |
Functions | Description |
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. |
strftime() |
Formats time as string. |
Types | Description |
clock_t |
Process running time. |
size_t |
Unsigned integer type. |
time_t |
Time type. |
tm |
Time structure. |
Macros | Description |
CLOCKS_PER_SEC |
Number of processor clock ticks per second. |
NULL |
Null pointer. |