Skip to content

Instantly share code, notes, and snippets.

@5kg
Created January 16, 2014 01:50
Show Gist options
  • Select an option

  • Save 5kg/8448446 to your computer and use it in GitHub Desktop.

Select an option

Save 5kg/8448446 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <limits.h>
#include <time.h>
int main()
{
time_t lo = 0x0, hi = LONG_MAX, mid;
while (lo < hi) {
mid = lo + (hi-lo)/2;
if (ctime(&mid))
lo = mid + 1;
else
hi = mid;
}
--mid;
printf("%lu %#lx\n", mid, mid);
printf("%s", ctime(&mid));
}
@5kg
Copy link
Copy Markdown
Author

5kg commented Jan 16, 2014

67767976233503999 0xf0c29d868b8cff
Tue Dec 31 23:59:59 2147483647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment