#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <limits.h>

/*-----------------------------------+/
 | When run:
 | $ ./rollover
 | End of the epoch in....
 | Tue Jan 19 03:14:05 2038
 | Tue Jan 19 03:14:06 2038
 | Tue Jan 19 03:14:07 2038
 | Fri Dec 13 20:45:52 1901
/+-----------------------------------*/

int main(int argc, char *argv[])
{
  time_t t = (time_t)LONG_MAX - 3;
  int i;

  printf("End of the epoch in....\n");

  i = 0;
  while(i < 4)
  {
    t++;
    i++;
    printf("%s", asctime(gmtime(&t)));
    sleep(1);
  }

  return(0);
}