From: utzoo!decvax!ittvax!swatt Newsgroups: net.bugs Title: The day that time went backwards Article-I.D.: ittvax.415 Posted: Fri Aug 13 16:53:41 1982 Received: Tue Aug 17 06:03:44 1982 Many people have worried about C and UNIX portability to new machine hosts, but it seems everyone has missed a widespread bug that will affect portability of UNIX into the next century. in /usr/include/sys/types.h (4.1bsd) the type "time_t" is declared as "int", which is the same as "long int". Now UNIX keeps time as the number of seconds since midnight January 1, 1975. What will happen as time marches on and eventually becomes negative? Well, "make" for one will break. I bet all the news software will collapse, or at least fail to expire articles. "readnews -a april 1" will not do anything reasonable. The list of things that will go wrong is probably only limited by: "grep -c time_t /usr/src/cmd/*.[cy] /usr/src/cmd/*/*.[cy]" How soon will this disaster hit us? The program: unsigned int breakdate = (1<<31)-1; main () { printf ("everything breaks %s\n", ctime (&breakdate)); } run on our machine gives: everything breaks Mon Jan 18 22:14:07 2038 This leaves us enough time to ammend the C language standard to include type "unsigned long", which will stave off the inevitable disaster for another 63 years, when the number of seconds since midnight January 1, 1975 will no longer fit in 32 bits. Sometime in 2101 UNIX will run out of time completely. One day that year, people all over the world will come to their automated offices (or stay at home and work on their workstation connected to their office via a Wide Area Network), and find themselves living in their great-great-grandfather's time. By then, every piece of silicon in the world (solar system, galaxy, universe?????) will be running some adaptation of UNIX(tm) 68.0, which will be portable to all digital, analog, fluidic, and optical computers. All over the UNIXverse, time will jump backwards 126 years! Talk about computer time bombs! Credit goes to Mack Endres for first noticing this serious bug. - Alan S. Watt