Curious dating behavior in PMMail 2000

Simon Bowring pmmail@rpglink.com
Mon, 03 Apr 2000 17:40:10 +0100 (BST)


On Fri, 31 Mar 2000 09:04:54 -0500, Jonathan B. Bayer wrote:

>The correspondent is wrong!  Unix doesn't suffer from the same Y2K bug
>as the mainframes and the PC's.  Unix keeps it's date as the number of
>seconds since Jan. 1, 1970.  The current 32 bit Unix's will have a
>rollover problem in 2038, but since I don't expect 32 bit unix's to be
>around then, I don't expect Unix to have this problem.

Unix software is almost as likely to suffer from Y2K bugs as
any other operating system - the problem is usually programmer 
related, not operating system. Some OSs, programming languages, 
or "established practices" encouraged Y2K bugs, some discouraged 
them.  C and Unix is "quite good" in this respect, but for 
example:

The C functions (under Unix or any other OS) that take a time in 
"seconds since Jan 1 1970" format and breaks it into useful fields 
(day of month, day of week etc) are called "localtime()" and 
"gmtime()".

Both functions return the year as an integer containing the 
number of years since *1900*.  Since for all years 1900-1999 this 
*could* be (and very often has been) treated as being equivalent to
the year in 2 digit format i.e. 00..99, however years after 1999 come
out as 100, 101 etc if the progammer treated the field wrong (and 
many did).

Usually this problem is cosmetic only, but not always!  

If localtime() has been originally specified to return the number of 
years since year 0, this problem would have been 
avoided.

Quite a few such programs did go wrong! Typically such programs
output the year as "100" (but other errors are possible).

The Y2K bug is occasionally "built into" an operating system, but
more usually it is lazy or ignorant programming that has created
the problem.

Also, a cobol program running on Unix is just as likely to go 
wrong as a cobol program running under MVS - it became an
established programming practice to use "PIC 999999" for dates
(a six digit number as MMDDYY etc). No operating system can get
round such designed-in Y2K bugs!

Simon