C - Library - Time
C - Library - Time
h>
C Library - <time.h>
Advertisements
IN INTERNATIONAL WATERS:
MASTER THE ROPES
The time.h header defines four variable types, two macro and various functions for manipulating date and time.
Library Variables
Following are the variable types defined in the header time.h −
size_t
1
This is the unsigned integral type and is the result of the sizeof keyword.
clock_t
2
This is a type suitable for storing the processor time.
time_t is
3
This is a type suitable for storing the calendar time.
struct tm
4
This is a structure used to hold the time and date.
struct tm {
int tm_sec; /* seconds, range 0 to 59 */
int tm_min; /* minutes, range 0 to 59 */
int tm_hour; /* hours, range 0 to 23 */
int tm_mday; /* day of the month, range 1 to 31 */
int tm_mon; /* month, range 0 to 11 */
int tm_year; /* The number of years since 1900 */
int tm_wday; /* day of the week, range 0 to 6 */
int tm_yday; /* day in the year, range 0 to 365 */
int tm_isdst; /* daylight saving time */
};
Library Macros
Following are the macros defined in the header time.h −
NULL
1
This macro is the value of a null pointer constant.
CLOCKS_PER_SEC
2
This macro represents the number of processor clocks per second.
Library Functions
Following are the functions defined in the header time.h −
https://www.tutorialspoint.com/c_standard_library/time_h.htm 1/2
1/30/2018 C Library - <time.h>
2 clock_t clock(void)
Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program).
size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr)
8 Formats the time represented in the structure timeptr according to the formatting rules defined in format and stored into str.
Advertisements
YouTube 38B
https://www.tutorialspoint.com/c_standard_library/time_h.htm 2/2