]> code.delx.au - gnu-emacs/blobdiff - lisp/timezone.el
(find-file-noselect): If after-find-file switches buffers,
[gnu-emacs] / lisp / timezone.el
index 56dbff02b5b314eeb570ccdc74b6a0366fd95ecb..8a847a9d97a7f5134988d5f3071ad4102c0d23a3 100644 (file)
@@ -1,10 +1,10 @@
-;;; Timezone package for GNU Emacs
+;;; timezone.el --- time zone package for GNU Emacs
 
 ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
 
-;;; Author: Masanobu Umeda
-;;; Maintainer: umerin@mse.kyutech.ac.jp
-;;; Keywords: news
+;; Author: Masanobu Umeda
+;; Maintainer: umerin@mse.kyutech.ac.jp
+;; Keywords: news
 
 ;; This file is part of GNU Emacs.
 
@@ -19,8 +19,9 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
 
@@ -130,6 +131,12 @@ Understands the following styles:
  (5) 22-AUG-1993 10:59:12.82
  (6) Thu, 11 Apr 16:17:12 91 [MET]
  (7) Mon, 6  Jul 16:47:20 T 1992 [MET]"
+  ;; Get rid of any text properties.
+  (and (stringp date)
+       (or (text-properties-at 0 date)
+          (next-property-change 0 date))
+       (setq date (copy-sequence date))
+       (set-text-properties 0 (length date) nil date))
   (let ((date (or date ""))
        (year nil)
        (month nil)
@@ -176,17 +183,13 @@ Understands the following styles:
          ;; 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))))
-         (setq month
-               (int-to-string
-                (cdr
-                 (assoc
-                  (upcase
-                   ;; Don't use `match-end' in order to take 3
-                   ;; letters from the beginning.
-                   (substring date
-                              (match-beginning month)
-                              (+ (match-beginning month) 3)))
-                  timezone-months-assoc))))
+         (let ((string (substring date
+                                  (match-beginning month)
+                                  (+ (match-beginning month) 3))))
+           (setq month
+                 (int-to-string
+                  (cdr (assoc (upcase string) timezone-months-assoc)))))
+
          (setq day
                (substring date (match-beginning day) (match-end day)))
          (setq time
@@ -291,7 +294,11 @@ If LOCAL is nil, it is assumed to be GMT.
 If TIMEZONE is nil, use the local time zone."
   (let* ((date   (timezone-parse-date date))
         (year   (string-to-int (aref date 0)))
-        (year   (if (< year 100) (+ year 1900) year))
+        (year   (cond ((< year 50)
+                       (+ year 2000))
+                      ((< year 100)
+                       (+ year 1900))
+                      (t year)))
         (month  (string-to-int (aref date 1)))
         (day    (string-to-int (aref date 2)))
         (time   (timezone-parse-time (aref date 3)))