Skip to content

Instantly share code, notes, and snippets.

@schwern
Created March 11, 2010 09:41
Show Gist options
  • Select an option

  • Save schwern/329000 to your computer and use it in GitHub Desktop.

Select an option

Save schwern/329000 to your computer and use it in GitHub Desktop.
#include <time.h>
#include <stdio.h>
#include <math.h>
int main() {
time_t test;
int last_year = 0;
struct tm *date;
int i;
for(i = 1; i <= 64; i++) {
printf("Trying gmtime(2**%d-1)\n", i);
test = (time_t)(powl(2,i) - 1);
date = gmtime(&test);
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