#include <stdio.h> #include <time.h> #include <errno.h> int main(int argc, const char * argv[]) { time_t ret, ret2, ret3; struct tm info, info2, info3; info.tm_year = 10; info.tm_mon = 10 - 1; info.tm_mday = 1; info.tm_hour = 0; info.tm_min = 0; info.tm_sec = 0; info.tm_isdst = -1; info.tm_wday = -1; info.tm_gmtoff = 0; info.tm_zone = 0; info2.tm_year = 10; info2.tm_mon = 1 - 1; info2.tm_mday = 1; info2.tm_hour = 0; info2.tm_min = 0; info2.tm_sec = 0; info2.tm_isdst = -1; info2.tm_wday = -1; info2.tm_gmtoff = 0; info2.tm_zone = 0; info3.tm_year = 10; info3.tm_mon = 10 - 1; info3.tm_mday = 1; info3.tm_hour = 0; info3.tm_min = 0; info3.tm_sec = 0; info3.tm_isdst = -1; info3.tm_wday = -1; info3.tm_gmtoff = 0; info3.tm_zone = 0; ret = mktime(&info); ret2 = mktime(&info2); ret3 = mktime(&info3); if( ret == -1 ) { printf("Error: unable to make time using mktime\n"); } else { char buff[70]; printf("-------\n"); printf("%s", asctime(&info)); strftime(buff, sizeof buff, "%A %c %z", &info); puts(buff); printf("-------\n"); printf("%s", asctime(&info2)); strftime(buff, sizeof buff, "%A %c %z", &info2); puts(buff); printf("-------\n"); printf("%s", asctime(&info3)); strftime(buff, sizeof buff, "%A %c %z", &info3); puts(buff); printf("-------\n"); } return(0); }