The C time.h header defines two macros and several types to manipulate date and time in our program.This header mainly deals with the calendar time(the Gregorian calendar).Some functions deal with local time,the time in your specific area and Daylight Saving Time.All the macros , types and functions declared under this header is given below.
|NULL||The value null|
|CLOCKS_PER_SEC||A constant value of type clock_t.Use this value to divide the value obtained by calling clock() to obtain the number of seconds elapsed used by CPU.|
size_t -An ‘unsigned int’ type.
clock_t -An arithmetic type returned by clock() function.
time_t -An arithmetic type returned by the functions timer() and mktime() functions.
struct tm -The members of this structure holds the values that represent time , date , hour , minute , seconds and so on.All the members of this structure are listed below.
|tm_sec||Holds the seconds value– [0,60]|
|tm_min||Holds the minute value –[0,59]|
|tm_hour||Holds the hours — [0,23]|
|tm_mday||Day of the month –[1,31]|
|tm_mon||Months since January –[0,11]|
|tm_year||Years since 1900|
|tm_wday||Week days [Sunday,Saturday]– [0,6]|
|tm_yday||Days since January 1- [0,365]|
|tm_isdst||Daylight saving time flag|
The value of ‘tm_isdst’ is +ve if the Daylight Saving Time is in effect,0(zero) if Daylight Saving Time is not in effect,negative if the information is not available.
|Function name and|
|clock_t||clock(void)||Determines the processor time used.|
|double||difftime(time_t time1, time_t time0)||Compute the time difference.|
|time_t||mktime(struct tm *timeptr)||converts the broken-down time,expressed as local time|
|time_t||time(time_t *timer)||Determines the current calendar time|
|char*||asctime(const struct tm *timeptr)||converts the broken-down time into string.|
|char*||ctime(const time_t *timer)||converts the calendar time into string.|
|struct tm*||gmtime(const time_t *timer)||converts the calendar time to string as UTC.|
|struct tm*||localtime(const time_t *timer)||Converts the calendar time to string as local time.|
|size_t||strftime(char * restrict s,|
size_t maxsize ,
const char * restrict format ,
const struct tm * restrict timeptr)
|Generate a string that holds the date and time in the format we want using conversion specifier.|