<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- Yes, this is hand-crafted HTML! -->
<html>
<head>
<title>The Year 2000 problem and the Amiga</title>
<body bgcolor="#ffffff" link="#ff0000" vlink="#ff0000">
<CENTER><IMG SRC="largerule.gif"><P>
<TABLE WIDTH=600><TR><TD>
<center><h1>The Year 2000 problem and the Amiga</h1></center>
To make a long story short, the Amiga in general does not suffer from the
Year 2000 problem in the context known to the PC world. However, the Amiga
faces three distinct date problems and a single, specific Year 2000 problem
with limited scope which will be described below.
<p>
<h2>1. Scope of this document</h2>
The following text refers to Amiga desktop computers built between 1986 and
1997 and only covers computer hardware configurations designed and built by
Commodore-Amiga, Inc. This specifically excludes 3<sup>rd</sup> party hardware
extensions, such as the Microbotics &quot;StarBoard&quot; which among other features offered
a battery backed up clock, but it includes Amiga computers built by Amiga
Technologies GmbH and Amiga, Inc.
<p>
<h2>2. How the Amiga handles date and time</h2>
The Amiga operating system has always followed the Unix model in measuring
time as the number of seconds that have elapsed since a fixed point of time.
Under AmigaOS that fixed point of time (also known as `epoch') is 00:00:00
of January 1, 1978 (Unix uses 00:00:00 GMT, January 1, 1970). The operating
system manages time and date through a central component known as
<code>timer.device</code>. This component reads and stores date and time information
using a data structure known as <code>timeval</code> which, in `C' language notation,
is shown below:<p>
<pre>
   struct timeval
   {
      ULONG tv_secs;
      ULONG tv_micro;
   };
</pre>
<p>In this context an <code>ULONG</code> refers to an unsigned 32 bit quantity. The
<code>tv_secs</code> structure member holds the number of seconds that have elapsed
since the AmigaOS epoch and the <code>tv_micro</code> member denotes the number of
microseconds (the 10<sup>-9</sup>th part of a second) that have elapsed since the last
second has passed.
<p>
Until AmigaOS 2.0 was introduced in 1989/1990 the operating system only
provided the methods for time keeping but did not offer any means to convert
the number of seconds elapsed since the AmigaOS epoch into human readable
format. This work was left to application software developers who implemented
different conversion algorithms with varying success.
<p>

<h2>2.1 The AmigaDOS date and time handling is special</h2>

&quot;AmigaDOS&quot; and &quot;AmigaOS&quot; are not two names for the same thing. Exactly the
opposite is true: AmigaDOS is (in a nutshell) the name of the AmigaOS layer which
implements filing systems and their actions, the command line interpreter and
which handles loading and relocation of executable binary files. AmigaDOS is
more or less a port of the Cambridge University TRIPOS 32 bit kernel. It has
its own peculiar data structures, including its own version of the <code>timeval</code>
structure described above. The AmigaDOS flavour is known as <code>DateStamp</code>, as
shown below:<p>
<pre>
   struct DateStamp
   {
      LONG ds_Days;
      LONG ds_Minute;
      LONG ds_Tick;
   };
</pre>
<p>In this context a <code>LONG</code> refers to a signed 32 bit quantity. The <code>ds_Days</code>
member contains the number of days (each day consists of exactly 24 hours)
that have passed since the AmigaOS epoch. The <code>ds_Minute</code> member denotes the
number of minutes that have passed since midnight (00:00:00) of the given day
and the <code>ds_Tick</code> member contains the number of &quot;ticks&quot; that have passed
since the last minute. A minute consist of 3,000 &quot;ticks&quot;, i.e. there are 50
ticks in a second.
<p>
AmigaDOS uses <code>DateStamp</code>s to describe file and volume creation dates, and all
shell commands follow the same model, i.e. if the system date is set through
the shell <code>Date</code> command, it will calculate time and date in <code>DateStamp</code>
format.<p>


<h2>2.2 Local time vs GMT</h2>

The Amiga operating system never knew the concept of local and global time.
While the AmigaOS 2.1 update (1992) introduced a locale preferences editor
that allowed for the time zone to be selected, the operating system itself
never put this feature to use or encouraged application software developers
to use it. One might argue that with this background, the AmigaOS was always
tuned to local time.
<p>

<h2>2.3 How the Amiga maintains its system time</h2>

The early Amiga computer models did not support a battery backed up real time
clock that would keep on ticking and maintaining local time even until after
the machine was switched off. For example, the first Amiga computer ever
(later christened the Amiga 1000) did not offer a battery backed up clock.
For the Amiga 500 the battery backed up clock was an extra hardware feature
one had to buy separately with a memory expansion. The Amiga 2000 and (with
the exception of the Amiga 600 and Amiga 500+ models) all models to follow
did feature a built-in battery backed up clock.
<p>
On machines without battery backed up clocks, the Amiga sets its system time
according to the modification date of the boot volume. In other words, the
point of time the last file was modified or created on a disk would determine
the system time. As this was by no means accurate, the AmigaOS boot process
would suggest and prompt you to adjust the system date once the system had
booted (as pictured below).
<p>
<img src="startup.gif" alt="The shell window prompting you to adjust the time" width=642 height=202>
<p>
With machines that featured battery backed up clocks, the system time was
read during the boot process. As of AmigaOS versions 1.2 and 1.3 a special
program, called <code>SetClock</code>, was responsible for reading the current clock
settings and setting the system time accordingly. Starting with AmigaOS
version 2.0 that functionality was integrated into the ROM operating system,
making the <code>SetClock</code> utility at least in part redundant.
<p>
If the system starts up without being able to set its system time, it defaults
to 00:00:00 January 1, 1978.
<p>

<h2>3. Setting and reading the time</h2>

The Amiga offers both a command line interface and a graphical user
interface. Both went through a number of changes over the years as will be
described below.
<p>

<h2>3.1 The command line interface</h2>

There are two shell commands which deal with the system date, these being
<code>SetClock</code> and <code>Date</code>. The <code>Date</code> command is for reading and setting the
current system date whereas the <code>SetClock</code> command deals with the battery
backed up clock, it reads and stores the current system time from/in it. The
<code>Date</code> command is of particular interest due to the human readable date format
it uses by default. Today you might invoke the <code>Date</code> command and receive the
following output:<p>
<pre>
   19-Sep-98
</pre><p>
As one can see, the year number is limited to two digits only. Even if a
different locale is used (e.g. french), the year will always be displayed with
its two last decimals only. Luckily, this numbering is consistent with the
following rule:
<p>
<ul>
<li> If the year number is greater than or equal to 78, the
     year is 1900 plus the number given (i.e. numbers 78..99
     indicate years 1978..1999).

<li> If the year number is smaller 78, the year is 2000 plus
     the number given (i.e. numbers 00..77 indicate years
     2000..2077).
</ul><p>
To set the system time to any year beyond 1999, you reverse the
rule, i.e. entering <kbd>date 01-jan-01</kbd> will set the time to
1 January, 2001.
<p>
All versions of the AmigaDOS <code>Date</code> command (version 1.1 through
version 37.1) display and parse the data format in the same
fashion. They behave consistently and predictably throughout all
Amiga operating system revisions.
<p>

<h2>3.2 The graphical user interface</h2>

The system time is set through the preferences editor which in AmigaOS
versions 1.0-1.3 used to be a single, monolithic program as pictured below:
<p>
<img src="prefs11.gif" alt="The Workbench 1.1 Preferences editor" width=642 height=202>
<p>
The controls for setting the system time are located in the top left corner of
the window. They allow the last two digits of the year to be adjusted; the
model follows the AmigaDOS <code>Date</code> command in that a year number smaller than
78 denotes a year in the range 2000..2077 and all other settings refer to a
year in the range 1978..1999.
<p>
With the introduction of AmigaOS 2.0, the time preferences editor was moved
into a single program named <code>Time</code> as pictured below:
<p>
<img src="prefs20.gif" alt="The Workbench 2.0 Time Preferences editor" width=334 height=152>
<p>
In this editor, the year can be entered as a four digit number. However, the
range is limited to the years 1978..2113.
<p>
When the AmigaOS 2.1 update was released, the time preferences editor was
revised, as can be seen below:
<p>
<img src="prefs21.gif" alt="The Workbench 2.1 Time Preferences editor" width=334 height=202>
<p>
Just like with its predecessor, the year can be entered as a four digit
number. In this case, the range is limited to the years 1991..2099.
<p>
<h2>4. The problems</h2>

As far as is known today, the Amiga faces four date problems. Two are design
problems caused by numeric overflow, one is caused by hardware limitations and
one is a real bug that will strike in the year 2000.
<p>

<h2>4.1 Negative time</h2>

As was outlined above, the Amiga measures time in seconds. As it turns out,
the number of seconds to accumulate until 19 January, 2046, 03:14:07 will form
the largest value a signed 32 bit integer number will hold. This is not a
problem for the time keeping module (<code>timer.device</code>), but application software
and other operating system components which treat the number of seconds as a
signed quantity will get into trouble one second later: the number of seconds
will rise to 2,147,483,648 which in two's complement format represents the
negative number -2,147,483,648. AmigaDOS, which always treats time as a signed
quantity, will consider this date to be invalid because it is negative. Worse,
the ROM date conversion routines exhibit a bug which, once the date is later
than 19 January, 2046, 03:14:07, causes all subsequent date operations to be
inaccurate. The immediate effect this has is that calculations on dates can be
off by more than two years.
<p>
This behaviour is consistent through all AmigaOS versions. A fix is not
available yet, but research is in progress to investigate whether this bug may
be fixed by updating several AmigaOS modules (<code>locale.library</code>, <code>dos.library</code>).
After all, this bug is &quot;just&quot; a side-effect of treating an unsigned quantity
as signed.
<p>

<h2>4.2 Time rolling over</h2>

An unsigned 32 bit integer can hold a maximum value of 4,294,967,295. When the
Amiga has accumulated that many seconds, it will be 7 February, 2114,
06:28:15. One second later the seconds counter will roll over and restart
at 0. In other words, on 7 February, 2114, 06:28:16 the Amiga will believe
that it is midnight on 1 January, 1978.
<p>
No fix for this problem is available yet.
<p>

<h2>4.3 The battery backed up clock can count only to 99</h2>

Amiga computers that feature a battery backed up real time clock use one of
two different hardware designs: either the Oki MSM6242RS (A500, A2000) or the
Ricoh RP5C01 (A3000, A1200, A4000) chip. As is common with clock chips of that
type, the year counter is implemented as a two digit BCD number. Once it
reaches the year 99, the counter will roll over and start again with 00.
<p>
Starting with Amiga operating system version 2.0, the boot process will read
the battery backed up clock time and set the system time accordingly. This
takes place every time the Amiga is reset. Because the year number covers only
two digits, the same algorithm as used by the AmigaDOS <code>Date</code> command is
employed. The consequence this has is that the Amiga system date set at
system startup time will always be in the range 1978..2077. While the system
clock will keep on ticking beyond 31 December, 2077 a system reset will set
the clock back to 1 January, 1978.
<p>
No fix for this problem is available yet.
<p>

<h2>4.4 SetClock stops working in the year 2000</h2>

The <code>SetClock</code> program shipped with the Amiga Workbench disk revisions 1.2 and
1.3 exhibits a bug which causes it to miscalculate the battery backed up clock
time starting with the year 2000. It is accurate only for the years
1978..1999. Once the year counter rolls over to 00, <code>SetClock</code> will believe
that the year is 1978 until the year 2079 is reached; that's when it will
believe that the year is 1979 -- which is not necessarily an improvement.
<p>
Please note that <strong>only</strong> the <code>SetClock</code> program found on the AmigaOS 1.2 and 1.3
Workbench disks suffers from this problem. Several versions of this program
were distributed, each between 4,000 and 7,000 bytes in size. To tell whether
you have a version that works or not, check the file size; if it is less than
1,000 bytes in size you will probably have the properly working version. If it
is larger than 4,000 bytes, you probably have the faulty version.
<p>
A fix for this problem is provided in <a href="ftp://ftp.amiga.com/pub/SetClock_v34.3.lha">this archive</a>. Download it and unpack it,
then read the enclosed <a href="ftp://ftp.amiga.com/pub/SetClock_ReadMe"><code>SetClock_ReadMe</code></a> file.
<p>
<hr>
<p align=right>Written by <a href="mailto:olsen@sourcery.han.de?subject=Re: The Year 2000 problem and the Amiga">Olaf Barthel</a> &#149; &copy; Copyright 1998 Amiga, Inc.</p>
</TD></TR></TABLE>
</CENTER>
</body>
</head>
</html>
