From xemacs-m  Tue Jan 21 21:41:43 1997
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
          by xemacs.org (8.8.4/8.8.4) with ESMTP
	  id VAA02800 for <xemacs-beta@xemacs.org>; Tue, 21 Jan 1997 21:41:41 -0600 (CST)
Received: (from steve@localhost)
          by altair.xemacs.org (8.8.4/8.8.4)
	  id TAA05730; Tue, 21 Jan 1997 19:52:24 -0800
To: xemacs-beta@xemacs.org
Subject: Re: 19.15b90: timezone-make-date-sortable fails
References: <QQbzme05252.199701211809@crystal.WonderWorks.COM>
X-Url: http://www.miranova.com/%7Esteve/
Mail-Copies-To: never
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@miranova.com>
In-Reply-To: Kyle Jones's message of Tue, 21 Jan 1997 13:09:59 -0500 (EST)
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: text/plain; charset=US-ASCII
Date: 21 Jan 1997 19:52:23 -0800
Message-ID: <m2sp3u9xjc.fsf@altair.xemacs.org>
Lines: 42
X-Mailer: Red Gnus v0.82/XEmacs 20.0

Kyle Jones writes:

> (require 'timezone)
> (timezone-make-date-sortable "Sat, 6 Nov 4 22:18:12 MET")

> fails with 

> Args out of range: "4", -2, nil

Shame on somebody, this is a Y2K bug. :-P

How about this hack?

Index: timezone.el
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/lisp/utils/timezone.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 timezone.el
--- timezone.el	1996/12/18 22:43:01	1.1.1.1
+++ timezone.el	1997/01/22 03:50:55
@@ -191,7 +191,16 @@
 		(substring date (match-beginning year) (match-end year)))
 	  ;; It is now Dec 1992.  8 years before the end of the World.
 	  (if (< (length year) 4)
-	      (setq year (concat "19" (substring year -2 nil))))
+	      ;; 2 digit years are bogus, so guess the century
+	      (let ((yr (string-to-int year)))
+		(when (>= yr 100)
+		  ;; What does a three digit year mean?
+		  (setq yr (- yr 100)))
+		(setq year (format "%d%02d"
+				   (if (< yr 70)
+				       20
+				     19)
+				   yr))))
 	  (let ((string (substring date
 				   (match-beginning month)
 				   (+ (match-beginning month) 3))))
-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.
Real men aren't afraid to use chains on icy roads.

