Sunday, November 9, 2014

UNIX 2038 Bug

                                       
                                      The end of Unix Time will occur on January 19, 2038 03:14:07 GMT.  On January 19, 2038 03:14:08 GMT all computers that still use 32 bit Unix Time will overflow.  This is known as the Year 2038 problem

                                      Unix Time is represented by a 32 bit whole number (an integer) that can be positive or negative (signed).  Unix was originally developed in the 60s and 70s so the "start" of Unix Time was set to January 1st 1970 at midnight GMT (Greenwich Mean Time) - this date/time was assigned the Unix Time value of 0.  This is what is know as the Unix Epoch

                                       While Unix Time begins at 0 on January 1st 1970 it also has a pre-history and an ending.  A 32 bit signed integer can represent whole numbers between -2147483648 and 2147483647.  Since Unix Time starts at 0, negative Unix Time values go back in time from the Epoch and positive numbers go forward in time.  This means that Unix Time spans from Unix Time value of -2147483648 or 20:45:52 GMT on December 13th 1901 to Unix Time value of 2147483647 or 3:14:07 GMT on January 19 in 2038.  These dates represent the beginning, the pre-history and the end of Unix Time

                                       The fix for the Year 2038 problem is to store Unix Time in a 64 bit integer.  This is already underway in most 64 bit Operating Systems but many systems may not be updated by 2038.