diff options
| author | Miles Bader | 1996-07-07 01:59:20 +0000 |
|---|---|---|
| committer | Miles Bader | 1996-07-07 01:59:20 +0000 |
| commit | ac4c237c27bab77712ed430cd0cbdf33eeb2ad07 (patch) | |
| tree | 59516bd49144aa20f9fe511250bbb06cb51d7f0a | |
| parent | 98aac09d3aabc7efa4fb216181abc9c5daab4529 (diff) | |
| download | emacs-ac4c237c27bab77712ed430cd0cbdf33eeb2ad07.tar.gz emacs-ac4c237c27bab77712ed430cd0cbdf33eeb2ad07.zip | |
(timezone-parse-date): Handle ISO 8601 dates, so rmailsort does the right
thing with them.
| -rw-r--r-- | lisp/timezone.el | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/lisp/timezone.el b/lisp/timezone.el index 8a847a9d97a..4d886ebe221 100644 --- a/lisp/timezone.el +++ b/lisp/timezone.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; timezone.el --- time zone package for GNU Emacs | 1 | ;;; timezone.el --- time zone package for GNU Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 1996 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Masanobu Umeda | 5 | ;; Author: Masanobu Umeda |
| 6 | ;; Maintainer: umerin@mse.kyutech.ac.jp | 6 | ;; Maintainer: umerin@mse.kyutech.ac.jp |
| @@ -131,7 +131,8 @@ Understands the following styles: | |||
| 131 | (5) 22-AUG-1993 10:59:12.82 | 131 | (5) 22-AUG-1993 10:59:12.82 |
| 132 | (6) Thu, 11 Apr 16:17:12 91 [MET] | 132 | (6) Thu, 11 Apr 16:17:12 91 [MET] |
| 133 | (7) Mon, 6 Jul 16:47:20 T 1992 [MET]" | 133 | (7) Mon, 6 Jul 16:47:20 T 1992 [MET]" |
| 134 | ;; Get rid of any text properties. | 134 | (8) 1996-06-24 21:13:12 [GMT]" |
| 135 | ;; Get rid of any text properties. | ||
| 135 | (and (stringp date) | 136 | (and (stringp date) |
| 136 | (or (text-properties-at 0 date) | 137 | (or (text-properties-at 0 date) |
| 137 | (next-property-change 0 date)) | 138 | (next-property-change 0 date)) |
| @@ -175,6 +176,14 @@ Understands the following styles: | |||
| 175 | "\\([0-9]+\\)-\\([A-Za-z]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)\\.[0-9]+" date) | 176 | "\\([0-9]+\\)-\\([A-Za-z]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)\\.[0-9]+" date) |
| 176 | ;; Styles: (5) without timezone. | 177 | ;; Styles: (5) without timezone. |
| 177 | (setq year 3 month 2 day 1 time 4 zone nil)) | 178 | (setq year 3 month 2 day 1 time 4 zone nil)) |
| 179 | ((string-match | ||
| 180 | "\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)[ \t]*\\([-+a-zA-Z0-9]+\\)" date) | ||
| 181 | ;; Styles: (8) with timezone. | ||
| 182 | (setq year 1 month 2 day 3 time 4 zone 5)) | ||
| 183 | ((string-match | ||
| 184 | "\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)" date) | ||
| 185 | ;; Styles: (8) without timezone. | ||
| 186 | (setq year 1 month 2 day 3 time 4 zone nil)) | ||
| 178 | ) | 187 | ) |
| 179 | (if year | 188 | (if year |
| 180 | (progn | 189 | (progn |
| @@ -183,13 +192,17 @@ Understands the following styles: | |||
| 183 | ;; It is now Dec 1992. 8 years before the end of the World. | 192 | ;; It is now Dec 1992. 8 years before the end of the World. |
| 184 | (if (< (length year) 4) | 193 | (if (< (length year) 4) |
| 185 | (setq year (concat "19" (substring year -2 nil)))) | 194 | (setq year (concat "19" (substring year -2 nil)))) |
| 186 | (let ((string (substring date | 195 | (setq month |
| 187 | (match-beginning month) | 196 | (if (= (aref date (+ (match-beginning month) 2)) ?-) |
| 188 | (+ (match-beginning month) 3)))) | 197 | ;; Handle numeric months, spanning exactly two digits. |
| 189 | (setq month | 198 | (substring date |
| 190 | (int-to-string | 199 | (match-beginning month) |
| 191 | (cdr (assoc (upcase string) timezone-months-assoc))))) | 200 | (+ (match-beginning month) 2)) |
| 192 | 201 | (let ((string (substring date | |
| 202 | (match-beginning month) | ||
| 203 | (+ (match-beginning month) 3)))) | ||
| 204 | (int-to-string | ||
| 205 | (cdr (assoc (upcase string) timezone-months-assoc)))))) | ||
| 193 | (setq day | 206 | (setq day |
| 194 | (substring date (match-beginning day) (match-end day))) | 207 | (substring date (match-beginning day) (match-end day))) |
| 195 | (setq time | 208 | (setq time |