comparison lisp/timezone.el @ 15614:6fb29f91d5ec

(timezone-parse-date): Handle ISO 8601 dates, so rmailsort does the right thing with them.
author Miles Bader <miles@gnu.org>
date Sun, 07 Jul 1996 01:59:20 +0000
parents 83f275dcd93a
children b7fddad951a0
comparison
equal deleted inserted replaced
15613:4c646bed64d0 15614:6fb29f91d5ec
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
7 ;; Keywords: news 7 ;; Keywords: news
8 8
129 (3) Mon Jan 16 16:12[:37] [GMT] 1989 129 (3) Mon Jan 16 16:12[:37] [GMT] 1989
130 (4) 6 May 1992 1641-JST (Wednesday) 130 (4) 6 May 1992 1641-JST (Wednesday)
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))
138 (setq date (copy-sequence date)) 139 (setq date (copy-sequence date))
139 (set-text-properties 0 (length date) nil date)) 140 (set-text-properties 0 (length date) nil date))
173 (setq year 3 month 2 day 1 time 4 zone 5)) 174 (setq year 3 month 2 day 1 time 4 zone 5))
174 ((string-match 175 ((string-match
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
181 (setq year 190 (setq year
182 (substring date (match-beginning year) (match-end year))) 191 (substring date (match-beginning year) (match-end year)))
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
196 (substring date (match-beginning time) (match-end time))))) 209 (substring date (match-beginning time) (match-end time)))))
197 (if zone 210 (if zone