Created
March 11, 2010 09:53
-
-
Save schwern/329008 to your computer and use it in GitHub Desktop.
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 <time.h> | |
| #include <stdio.h> | |
| #include <math.h> | |
| int main() { | |
| time_t test; | |
| int last_year = 70; | |
| struct tm *date; | |
| int i; | |
| for(i = 1; i <= 64; i++) { | |
| printf("Trying gmtime(2**%d-1)\n", i); | |
| test = (time_t)(pow(2,i) - 1); | |
| test = -test; | |
| date = gmtime(&test); | |
| printf("Time: %lld, Year: %d\n", (long long int)test, date->tm_year); | |
| if( last_year < date->tm_year ) { | |
| printf("Failed at %lld. Previous year: %d. This year: %d.\n", (long long int)test, last_year, date->tm_year); | |
| return 1; | |
| } | |
| else { | |
| last_year = date->tm_year; | |
| } | |
| } | |
| printf("Finished.\n"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment