Created
January 15, 2017 22:51
-
-
Save muaddib1971/6b50b8bb6775f519f7aaa61a7da80736 to your computer and use it in GitHub Desktop.
program to calculate the largest year representable on a 64 bit system.
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 <stdlib.h> | |
| #include <time.h> | |
| #include <limits.h> | |
| #define ONE_YEAR 60*60*24*366 | |
| int main(void) | |
| { | |
| time_t now = 67767751872000000l; | |
| for(;;) | |
| { | |
| char * curtime = ctime(&now); | |
| if(!curtime) | |
| { | |
| break; | |
| } | |
| printf("%s", curtime); | |
| printf("%ld\n", now); | |
| now += ONE_YEAR; | |
| } | |
| return EXIT_SUCCESS; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment