Skip to content

Instantly share code, notes, and snippets.

@muaddib1971
Created January 15, 2017 22:51
Show Gist options
  • Select an option

  • Save muaddib1971/6b50b8bb6775f519f7aaa61a7da80736 to your computer and use it in GitHub Desktop.

Select an option

Save muaddib1971/6b50b8bb6775f519f7aaa61a7da80736 to your computer and use it in GitHub Desktop.
program to calculate the largest year representable on a 64 bit system.
#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