Newsgroups: comp.os.minix
Subject: The Minix kernel and the end of time
Organization: Syracuse University, Syracuse
From: mcconnel@hydra.syr.edu (Terry R. McConnell)
NNTP-Posting-Host: hydra.syr.edu
Message-ID: <3655d45d.0@news.syr.edu>
Date: 20 Nov 1998 15:43:09 -0500
X-Trace: 20 Nov 1998 15:43:09 -0500, hydra.syr.edu
Lines: 45
Path: news.adfa.oz.au!clarion.carno.net.au!news0.optus.net.au!news1.optus.net.au!optus!intgwpad.nntp.telstra.net!newspump.monmouth.com!newspeer.monmouth.com!news.maxwell.syr.edu!news.syr.edu!hydra.syr.edu!mcconnel

The following is the result of some correspondence with a visitor to my
web site. I think it raises some interesting questions. Anyone care to
comment?


|
|When will the Minix clock will fail? my guess is on the year 2038. 
|Assuming an unsigned 32-bit (just like unix). However I am not able to 
|tell from the source code. 
|

Looking at the Minix 1.7 source code I find the following declaration in
kernel/glo.h:

EXTERN real_time realtime;  /* real time clock */

real_time is typedef'd to long in type.h. As far as I can tell, the purpose
of the realtime variable is to keep track of the actual number of seconds
elapsed since Jan. 1, 1970 at midnight. On most implementations, the largest
value that can be stored in a (signed) long is
2^31 - 1 = 2147483647. This number of seconds after midnight, Jan. 1, 1970
gives Mon Jan 18 22:14:07 2038 (GMT). This, therefore, is the last time that
the realtime variable can hold the correct time in Minix. (Actually, machines
in New Zealand will be first to fail, and since New Zealand is GMT + 12,
the end of Minix time will actually begin at 10:14:07 (GMT) on that date.)

Your question raises some interesting further questions which I really don't
know the answers to offhand:

1) What are the consequences (if any) for the Minix kernel of realtime
containing the wrong time ?

2) How does the value of realtime get set in the first place? I can't seem
to find where in the kernel source this occurs -- it gets updated in the
clock task code, but apparently not initialized there. Perhaps the boot
monitor gets the time from the BIOS and sets the value of realtime when it
starts the kernel? 

3) Some BIOS's can't handle times after Y2K. What happens when Minix is
booted on such a machine ?
-- 
************************************************************************
Terry R. McConnell   Mathematics/304B Carnegie/Syracuse, N.Y. 13244-1150
trmcconn@syr.edu                            http://barnyard.syr.edu/~tmc 
************************************************************************
