Time.h


'Time.h' header file defines several functions to work on time manipulation and conversion.

Time manipulation

Function Name ReturnWhat They Do
clock number of clock ticks elapsed since the program start

Clock program

difftime difference in seconds(time2-time1) as a floating point double

Return difference between two times

mktime time_t value corresponding to calender time passed as argument

Convert tm structure to time_t

Time current calender time as time_t object

Get current time


Conversion:

Function Name ReturnWhat They Do
asctime C string containing date and time information in a human readable format

Convert tm structure to string

ctime C string containing date and time information in a human readable format

Convert time_t value to string

gmtime pointer to a tm structure with time information filled in

Convert time_t to tm as UTC time

localtime pointer to a structure with the time information filled in

Convert time_t to tm as local time

strftime number of characters copied to pointer (not including the terminating null-character) is returned

Format time to string


Quantitative Aptitude
Reasoning
Programming
Interview