Created
January 15, 2020 09:09
-
-
Save mutsune/07798b710f191d2e260add844dd962b0 to your computer and use it in GitHub Desktop.
Y2038
This file contains hidden or 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
| #include <stdio.h> | |
| #include <time.h> | |
| #include <limits.h> | |
| #include <math.h> | |
| int main(void) | |
| { | |
| time_t t = time(NULL); | |
| time_t end = 2147483647; | |
| printf("[props]\n"); | |
| printf("2^31-1: %d\n", (int)(pow(2.0, 31.0) - 1)); | |
| printf("INT_MAX: %d\n", INT_MAX); | |
| printf("time_t size: %zd bit\n\n", sizeof(time_t) * 8); | |
| printf("[now]\n"); | |
| printf("form: %s", ctime(&t)); | |
| printf("unix: %ld\n", t); | |
| printf("\n[end date]\n"); | |
| printf("form: %s", ctime(&end)); | |
| printf("unix: %ld\n", end); | |
| end += 1; | |
| printf("\n[end date + 1]\n"); | |
| printf("form: %s", ctime(&end)); | |
| printf("unix: %ld\n", end); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment