ModulaTor logo, 7.8KB

The ModulaTor

Oberon-2 and Modula-2 Technical Publication

Ubaye's First Independent Modula-2 & Oberon-2 Journal! Nr. 74, Jun-1998 (5th ed. 04-Dec-1998)

The Year 10000 Problem

© (1998-1999) by Günter Dotzel, ModulaWare

Did you fix the Year-2000-Bugs? I guess it was more trouble than you initialy estimated. With the widespread use of C and Unix, there is a high probability that the information technology community will find date-related trouble again in the year 2038.

OpenVMS was designed from the beginning (1978) to deal with a four digit year number. Not all existing OpenVMS user applications took advantage of this feature.

Recently we've checked our OpenVMS Modula-2 and Oberon-2 compilers and all library modules for Y2K-compliance. All compilers use the OpenVMS 64 bit date/time format, which is Y2K-compliant (symbol and object file time stamps, listings). In the set of ISO Modula-2 library modules, there is only module SysClock which deals with date and time. This module no longer subtracts 1900 from the year number and is Y2K-compliant. The non-ISO Modula-2 library modules are described below.

In the Alpha Oberon System (AOS), we've fixed two 3rd party modules which only processed two digits, i.e: modules DigitalClockElems and StampElems.

- DigitalClockElems only displays and prints the date and time. So no problems should arise except if you saved an Oberon text window which contained the old 2-digit year format in a text file to process it later.

- StampElems writes/reads a date stamp in Oberon files in ascii-format. The year number was previously written with 2 digits only in the date stam. Now 4 year-digits are written in the date stamp. The date-string is always terminated with CHR(0). When reading a date stamp, StampElems reads (and displays) 2 or 4 digits, depending on how much digits were written.

We also corrected one procedure from an inner-core module of AOS: Unix.LocalTime now no longer subtracts 1900 from the year number. The type of the Tm.year field in Unix was already declared as LONGINT, which has at least 32 bits. So no problems should arise except if you saved an Oberon text window which contained the old 2-digit year format in a text file to process it later. Also the following 3rd party modules were corrected:
dclockElems now no longer adds 1900 to the year number
DialogDates (procedure Format) of the Dialogs package and
VCS (procedure Format) of the version control system now longer cut the year number using MOD 128 and now produces a year number with 4 digits.

The following modules from the non-ISO Modula-2 library were checked for Year-2000 (Y2K) compliance and were necessary amended:


  Module      Filename         Y2K-compliant        Changes in impl.-module
                                                    concerning year number
  _______________________________________________________________________
  Modula-2 96 bit date/time format:
  Clock       CLOCK.DEF        yes                  1900 not subtracted
  UnivDate    UNIVDATE.DEF     yes                  1900 not added
  UnivRDate   UNIVRDATE.DEF    yes                  1900 not subtracted

  OpenVMS 64 bit date/time-format:
  Timer       TIMER.DEF        yes
  UnivRWDate  UNIVRWDAT.DEF    yes
  DateTime    DATETIME.DEF     yes
  GetConvTime GETCONVTIME.DEF  yes

  Modula-2 48 bit PDP-11/RT-11-compatible date/time format:
  RTClock     RTCLOCK.DEF      yes, until year 2027 (use Clock instead)
  UnivRTDate  UNIVRTDAT.DEF    yes, until year 2027 (use UnivDate)

The source code of all above mentioned Modula-2 modules (.def and .mod) are contained in the MaX and MVR distribution kit.

In neither case, recompilation of the definition module was required. UnivRTDate provides the PDP-11/RT-11 binary compatible date format. RTClock and UnivRTDate is only used in one test program UseVMSFileSystem (file USEVMSFIL.MOD). Where the RT-11 compatible date format is not required, module UnivDate replaces UnivRTDate under OpenVMS VAX and Alpha.

1900 is no longer subtracted in module Clock and UnivRDate for the record field Time.day and thus 1900 is no longer added in UnivDate.

Maximal year number: Clock's Time.day has a field width of 23 bit to store the year number. This results in a maximal possible year number of 2**23 -1, which is 8388607, although UnivRDate.ReadDate restricts it to 999999. (In previous versions the limit was 9999).

Although the previous method to subtract/add 1900 to the year number allowed to identify the centuries (1999 = 99, 2000 = 100, 2001 = 101, ... 2100 = 200, ...), the actual year number is now stored in Time.day to be consistent with module SysClock, which is Y2K-compliant.

Module Timer, UnivRWDate, DateTime and GetConvTime use the OpenVMS DateTime 64 bit format which is the absolute number of 100 nanosecond units since system base time (see OpenVMS system service routine SYS$GETTIM). This provides for

(2^63-1)*100E-9/3600/24/365 = 29247 years since system base time (OpenVMS uses only positive signed 64-bit values, hence 2^63 and not 2^64).

The year number number range which can be respresented is further restricted by the OpenVMS system service routines SYS$ASCTIM and SYS$BINTIM from [17-Nov-]1858 to [31-Dec-]9999 for absolute time. For example in 01-Jan-10000, the OpenVMS [V7.1]

$show time

command outputs 01-Jan-****, but SYS$GETTIM and the number conversion routine SYS$NUMTIM (see Clock.Mod) still deliver the correct results. You can try it with the test_Y10K module:

  MODULE test_Y10K;
  IMPORT
    Clock, UnivDate,
    Timer, UnivRWDate,
    SysClock,
    InOut;
  VAR t: Clock.Time;
    tt: Timer.Time;
    dt: SysClock.DateTime;

  BEGIN
    Clock.   GetTime(t);
    Timer.   GetTime(tt);
    SysClock.GetClock(dt); (* iso modula-2 library module *)

    UnivDate.WriteDate(InOut.Write,t); InOut.Write(" ");
    UnivDate.WriteTime(InOut.Write,t);
    InOut.   WriteLn;

    UnivRWDate.WriteDate(InOut.Write, tt); InOut.Write(" ");
    UnivRWDate.WriteTime(InOut.Write, tt);
    InOut.     WriteLn;

    (* convert DateTime to a printable format; see Clock.Def *)
    t.day:= (dt.year*16 + dt.month)*32 + dt.day;
    t.minute := (dt.hour*60) + dt.minute;
    t.millisecond:=(dt.second*1000)+(dt.fractions*10);
    UnivDate.WriteDate(InOut.Write,t); InOut.Write(" ");
    UnivDate.WriteTime(InOut.Write,t);
    InOut.   WriteLn;
  END test_Y10K.

Compile and link test_Y10K, execute the OpenVMS command

$set time="31-dec-9999 23:25:59"

when you are the only user and nothing else is running and then run test_Y10K. Don't forget to set the date and time back to the actual values.

At least you can now say to your boss, should she ask about Y2K, that you've already got OpenVMS Modula-2 Y10K-ready.

Once bitten: Applications written in C/C++ will get into the same trouble with the year number again in a couple of decades. Quoting from the guidelines for year 2000 code investigations located at www.openvms.digital.com:

"We specified 2038 as a cutoff date for the Year 2000 evaluation because another industry-wide, date-related problem may occur in 2038. That problem is analogous to the Year 2000 problem, but is caused by limitations in the current C language standards for time and date storage."


The ModulaTor's Forum

Recommended reading

Ayn Rand: "We the Living", 1936. (The 50th annviversary edition, 1996, is now available as hardcover edition or paperback).
Even after all major countries of Europe got socialist governments in 1998, it is not too late to think about the implied consequences for the society and their effects to the quality of life and morality. Reading about politics is tiresome, except when written by the Russian Radical: Ayn Rand grew up in Russia, emmigrated to America in 1926 and started this book, her debut, in 1930, when she was only twenty-five. This fascinating fiction portrays Kira, Leo, and Andrei, who demand the right to live their own lives and pursue their own happiness. It tells of Kira's passionate love, held like a fortress against the corrupting evil of a totalitarian state. While not a story of politics, the theme of this classic novel is the struggle of the individual against the state, showing what the theory of socialism means in practice.

Ayn Rand: "The Fountainhead", 1943. (The 60th annviversary edition, 1993, is now available as hardcover edition or paperback).
Having read "We the Living" non-stop, you'll eagerly want to continue reading Ayn Rand's second classic fiction. The Fountainhead is about a young architect, his violent battle against conventional standards, and his explosive love with a beautifull woman who struggles to defeat him. A story about a hero and about those who try to destroy him. Eventhough this book has 704 pages, you'll struggle against reading too fast, in order to avoid arriving at the end, when she leaves you alone in her philosophical space called Objectivism.


IMPRESSUM: The ModulaTor is an unrefereed journal. Technical papers are to be taken as working papers and personal rather than organizational statements. Items are printed at the discretion of the Editor based upon his judgement on the interest and relevancy to the readership. Letters, announcements, and other items of professional interest are selected on the same basis. Office of publication. The Editor of The ModulaTor is Günter Dotzel; he can be reached at mailto:[email deleted due to spam]


Home Site_index Contact Legal Buy_products OpenVMS_compiler Alpha_Oberon_System ModulaTor Bibliography Oberon[-2]_links Modula-2_links General interesting book recommendations
Amazon.com [3KB] [Any browser]


Webdesign by www.otolo.com/webworx, 04-Dec-1998