#define _XOPEN_SOURCE #include "stdio.h" #include "stdlib.h" #include "time.h" #include "string.h" int main(void) { char buf[100]; struct tm tm1, tm2; memset(&tm1, 0, sizeof(struct tm)); memset(&tm2, 0, sizeof(struct tm)); strptime("1/1/1970 00:00:00", "%d/%m/%Y %H:%M:%S", &tm1); strptime("1/1/1970 00:00:00", "%d/%m/%Y %H:%M:%S", &tm2); strftime(buf, 100, "%s", &tm1); printf("strftime: %s\n", buf); time_t seg = mktime(&tm2); printf("mktime: %ld\n", seg); return 0; }