Mktime Function
Syntax:
time_t mktime(struct tm *time);
Example:
#include <time.h> #include <stdio.h> int main() { struct tm p; time_t time_of_day; p.tm_year = 2005-1900; p.tm_mon = 0; p.tm_mday = 3; p.tm_hour = 0; /* hour, min, seconds have no effect */ p.tm_min = 0; /* as long as they don't cause a */ p.tm_sec = 1; /* new day to occur */ p.tm_isdst = 0; time_of_day = mktime(&p); printf(ctime(&time_of_day)); return 0; }Back