emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog timezone.el


From: Mark A. Hershberger
Subject: [Emacs-diffs] emacs/lisp ChangeLog timezone.el
Date: Fri, 14 Aug 2009 18:18:42 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Mark A. Hershberger <hexmode>   09/08/14 18:18:41

Modified files:
        lisp           : ChangeLog timezone.el 

Log message:
        add ability to understand ISO8601 basic format as well as the extended 
one.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15934&r2=1.15935
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/timezone.el?cvsroot=emacs&r1=1.44&r2=1.45

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15934
retrieving revision 1.15935
diff -u -b -r1.15934 -r1.15935
--- ChangeLog   14 Aug 2009 09:38:35 -0000      1.15934
+++ ChangeLog   14 Aug 2009 18:18:39 -0000      1.15935
@@ -1,3 +1,9 @@
+2009-08-14  Mark A. Hershberger  <address@hidden>
+
+       * timezone.el (timezone-parse-date): Add ability to understand ISO
+       basic format (minimal separators) dates in addition to the
+       already-supported extended format dates.
+
 2009-08-14  Eli Zaretskii  <address@hidden>
 
        * international/ucs-normalize.el: Add a `coding' file variable.

Index: timezone.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/timezone.el,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- timezone.el 5 Jan 2009 03:19:49 -0000       1.44
+++ timezone.el 14 Aug 2009 18:18:41 -0000      1.45
@@ -134,7 +134,8 @@
  (6) Thu, 11 Apr 16:17:12 91 [MET]
  (7) Mon, 6  Jul 16:47:20 T 1992 [MET]
  (8) 1996-06-24 21:13:12 [GMT]
- (9) 1996-06-24 21:13-ZONE"
+ (9) 1996-06-24 21:13-ZONE
+ (10) 19960624T211312"
  ;; Get rid of any text properties.
   (and (stringp date)
        (or (text-properties-at 0 date)
@@ -190,26 +191,32 @@
           ;; Styles: (8) with timezone.
           (setq year 1 month 2 day 3 time 4 zone 5))
          ((string-match
-           "\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)[T \t]+\\([0-9]+:[0-9]+\\)[ 
\t]+\\([-+a-zA-Z0-9:]+\\)" date)
+            "\\([0-9]\\{4\\}\\)-?\\([0-9]\\{0,2\\}\\)-?\\([0-9]\\{0,2\\}\\)[T 
\t]+\\([0-9]\\{0,2\\}:?[0-9]\\{0,2\\}:?[0-9]\\{0,2\\}\\)[ 
\t]*\\([-+a-zA-Z]+[0-9:]*\\)" date)
           ;; Styles: (8) with timezone with a colon in it.
           (setq year 1 month 2 day 3 time 4 zone 5))
          ((string-match
-           "\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)[T 
\t]+\\([0-9]+:[0-9]+:[0-9]+\\)" date)
+            "\\([0-9]\\{4\\}\\)-?\\([0-9]\\{0,2\\}\\)-?\\([0-9]\\{0,2\\}\\)[T 
\t]+\\([0-9]+:?[0-9]+:?[0-9]+\\)" date)
           ;; Styles: (8) without timezone.
           (setq year 1 month 2 day 3 time 4 zone nil))
          )
+
     (when year
       (setq year (match-string year date))
       ;; Guess ambiguous years.  Assume years < 69 don't predate the
       ;; Unix Epoch, so are 2000+.  Three-digit years are assumed to
       ;; be relative to 1900.
-      (if (< (length year) 4)
+      (when (< (length year) 4)
          (let ((y (string-to-number year)))
-           (if (< y 69)
+          (when (< y 69)
                (setq y (+ y 100)))
            (setq year (int-to-string (+ 1900 y)))))
       (setq month
-           (if (= (aref date (+ (match-beginning month) 2)) ?-)
+            (if (or (= (aref date (+ (match-beginning month) 2)) ?-)
+                    (let ((n (string-to-number
+                              (char-to-string
+                               (aref date (+ (match-beginning month) 2))))))
+                      (= (aref (number-to-string n) 0)
+                         (aref date (+ (match-beginning month) 2)))))
                ;; Handle numeric months, spanning exactly two digits.
                (substring date
                           (match-beginning month)
@@ -219,11 +226,11 @@
                                        (+ (match-beginning month) 3)))
                     (monthnum
                      (cdr (assoc (upcase string) timezone-months-assoc))))
-               (if monthnum
+                (when monthnum
                    (int-to-string monthnum)))))
       (setq day (match-string day date))
       (setq time (match-string time date)))
-    (if zone (setq zone (match-string zone date)))
+    (when zone (setq zone (match-string zone date)))
     ;; Return a vector.
     (if (and year month)
        (vector year month day time zone)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]