Mktime(Converts the time structure data to the following number of seconds)
Header file
# Include <time. h>
Define functions
Time_tMktime(Strcut TM * timeptr );
Function Description
Mktime() Is used to convert the TM structure data referred to by the timeptr parameter to the number of seconds that have elapsed since 00:00:00 January 1, January 1, 1970 ad utc.
Return Value
Returns the number of seconds that have elapsed.
Example
/* Obtain the time (in seconds) with time (), and use localtime ()
Convert to struct TM and then use mktine () to convert struct TM to the original number of seconds */
# Include <time. h>
Main ()
{
Time_t timep;
Strcut TM * P;
Time (& timep );
Printf ("Time (): % d \ n", timep );
P = localtime (& timep );
Timep =Mktime(P );
Printf ("Time ()-> localtime ()->Mktime(): % D \ n ", timep );
}
Run
Time (): 974943297
Time ()-> localtime ()->Mktime(): 974943297