Created
January 18, 2018 16:14
-
-
Save adrianlzt/9c6933675479d52a368142b4eda39085 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment