Subject: Re: Before I offically call this a time bug can someone else try this?
To: Michael C. Richardson <mcr@sandelman.ottawa.on.ca>
From: Perry E. Metzger <perry@piermont.com>
List: tech-kern
Date: 08/04/1998 21:06:17
"Michael C. Richardson" writes:
The End of Time is Mon Jan 18 22:14:07 2038, GMT +0500
I've updated your code to do this.
/*
* if time_t is 32 bits, then
* the "End of Time" is Mon Jan 18 22:14:07 2038
* This code copes with that. Sort of.
* Why do we do this? Sometimes RTC's screw up or are badly set.
*/
/* is time_t a 4 byte quantity? */
if(sizeof(time_t) <= sizeof(int32_t)) {
if(yr >= 138) {
printf("WARNING: RTC time at or beyond 2038.\n");
yr = 137;
printf("WARNING: year set back to 2037.\n");
printf("WARNING: CHECK AND RESET THE DATE!\n");
}
}
I'll be committing it on port-i386 fairly soon.
>
> I was thinking about something like this:
>
> --- clock.c~ Thu Feb 13 07:17:15 1997
> +++ clock.c Tue Aug 4 08:18:21 1998
> @@ -530,6 +530,14 @@
> yr = hexdectodec(rtclk[MC_YEAR]);
> yr = (yr < 70) ? yr+100 : yr;
>
> + /* is time_t a 4 byte quantity? */
> + if(sizeof(time_t) <= sizeof(int32_t)) {
> + if(yr > 138) {
> + printf("WARNING: signed time_t can not cope beyond 2038\n");
> + yr = 138;
> + }
> + }
> +
> n = sec + 60 * min + 3600 * hr;
> n += (dom - 1) * 3600 * 24;
>
>
> It effectively "solves" the 2038 problem by stopping the clock on the next
> boot. And it goes away when time_t becomes 64 bits.
>
> :!mcr!: | Network and security consulting/contract programming
> Michael Richardson | Firewalls, TCP/IP and Unix administration
> Personal: <A HREF="http://www.sandelman.ottawa.on.ca/People/Michael_Richards
on/Bio.html">mcr@sandelman.ottawa.on.ca</A>. PGP key available.
> Corporate: <A HREF="http://www.sandelman.ottawa.on.ca/SSW/">sales@sandelman.
ottawa.on.ca</A>.
> ON HUMILITY: To err is human, to moo bovine.
>
>
>