]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix minor Y10k bugs.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 4 May 2012 06:13:18 +0000 (23:13 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 4 May 2012 06:13:18 +0000 (23:13 -0700)
* lisp/arc-mode.el (archive-unixdate):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-forms.el (math-this-year):
* lisp/gnus/nnweb.el (nnweb-google-parse-1):
* lisp/emacs-lisp/copyright.el (copyright-current-year)
(copyright-update-year, copyright):
* lisp/tar-mode.el (tar-clip-time-string):
* lisp/time.el (display-time-update):
Don't assume years have 4 digits.

lisp/ChangeLog
lisp/arc-mode.el
lisp/autoinsert.el
lisp/calc/calc-forms.el
lisp/emacs-lisp/copyright.el
lisp/gnus/ChangeLog
lisp/gnus/nnweb.el
lisp/tar-mode.el
lisp/time.el

index d57d93a706043b38f971ba1c1f385b7fac1af3aa..7d7cf56cd771c8af4b304dfb0c0d57e7020df8d0 100644 (file)
@@ -1,3 +1,15 @@
+2012-05-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix minor Y10k bugs.
+       * arc-mode.el (archive-unixdate):
+       * autoinsert.el (auto-insert-alist):
+       * calc/calc-forms.el (math-this-year):
+       * emacs-lisp/copyright.el (copyright-current-year)
+       (copyright-update-year, copyright):
+       * tar-mode.el (tar-clip-time-string):
+       * time.el (display-time-update):
+       Don't assume years have 4 digits.
+
 2012-05-04  Chong Yidong  <cyd@gnu.org>
 
        * dos-w32.el (file-name-buffer-file-type-alist)
index 8b17208983f37985745c676443dc428d018b3a60..c776a3f8b5ce11a2149d7d6a6e53ad4d417db613 100644 (file)
@@ -622,11 +622,12 @@ the mode is invalid.  If ERROR is nil then nil will be returned."
 
 (defun archive-unixdate (low high)
   "Stringify Unix (LOW HIGH) date."
-  (let ((str (current-time-string (cons high low))))
+  (let* ((time (cons high low))
+        (str (current-time-string time)))
     (format "%s-%s-%s"
            (substring str 8 10)
            (substring str 4 7)
-           (substring str 20 24))))
+           (format-time-string "%Y" time))))
 
 (defun archive-unixtime (low high)
   "Stringify Unix (LOW HIGH) time."
index de2835580c29195f680d873eb35f5a0744b313e0..e7639b6f8a35f83057400f90777cae3a9a52a30d 100644 (file)
@@ -135,7 +135,7 @@ If this contains a %s, that will be replaced by the matching rule."
 
     (("\\.[1-9]\\'" . "Man page skeleton")
      "Short description: "
-     ".\\\" Copyright (C), " (substring (current-time-string) -4) "  "
+     ".\\\" Copyright (C), " (format-time-string "%Y") "  "
      (getenv "ORGANIZATION") | (progn user-full-name)
      "
 .\\\" You may distribute this file under the terms of the GNU Free
@@ -166,7 +166,7 @@ If this contains a %s, that will be replaced by the matching rule."
      "Short description: "
      ";;; " (file-name-nondirectory (buffer-file-name)) " --- " str "
 
-;; Copyright (C) " (substring (current-time-string) -4) "  "
+;; Copyright (C) " (format-time-string "%Y") "  "
  (getenv "ORGANIZATION") | (progn user-full-name) "
 
 ;; Author: " (user-full-name)
@@ -222,7 +222,7 @@ If this contains a %s, that will be replaced by the matching rule."
 @copying\n"
       (setq short-description (read-string "Short description: "))
       ".\n\n"
-      "Copyright @copyright{} " (substring (current-time-string) -4) "  "
+      "Copyright @copyright{} " (format-time-string "%Y") "  "
       (getenv "ORGANIZATION") | (progn user-full-name) "
 
 @quotation
index 96cc74f7ef6f413c47a08b18b6180fe09c0210ee..dfc5dfc65889d5b856fb310069abb546e083751e 100644 (file)
 
 
 (defun math-this-year ()
-  (string-to-number (substring (current-time-string) -4)))
+  (nth 5 (decode-time)))
 
 (defun math-leap-year-p (year)
   (if (Math-lessp year 1752)
index 09b456b54babb436ef99e02f0ced9e145afb30f1..8e96d95c5dd0bfe00793b3e7fba1bc0103137812 100644 (file)
@@ -110,7 +110,7 @@ When this is `function', only ask when called non-interactively."
 
 ;; This is a defvar rather than a defconst, because the year can
 ;; change during the Emacs session.
-(defvar copyright-current-year (substring (current-time-string) -4)
+(defvar copyright-current-year (format-time-string "%Y")
   "String representing the current year.")
 
 (defsubst copyright-limit ()            ; re-search-forward BOUND
@@ -181,8 +181,7 @@ skips to the end of all the years."
   ;; This uses the match-data from copyright-find-copyright/end.
   (goto-char (match-end 1))
   (copyright-find-end)
-  ;; Note that `current-time-string' isn't locale-sensitive.
-  (setq copyright-current-year (substring (current-time-string) -4))
+  (setq copyright-current-year (format-time-string "%Y"))
   (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3))
                   (substring copyright-current-year -2))
     (if (or noquery
@@ -347,7 +346,7 @@ independently replaces consecutive years with a range."
   "Insert a copyright by $ORGANIZATION notice at cursor."
   "Company: "
   comment-start
-  "Copyright (C) " `(substring (current-time-string) -4) " by "
+  "Copyright (C) " `(format-time-string "%Y") " by "
   (or (getenv "ORGANIZATION")
       str)
   '(if (copyright-offset-too-large-p)
index 4938336742a9e2e09d290404cf54319f57c6099f..9000ccb9fefce273921219f38ef5dd0e46ac0592 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix minor Y10k bug.
+       * nnweb.el (nnweb-google-parse-1): Don't assume years have 4 digits.
+
 2012-05-01  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * nnimap.el (nnimap-open-connection-1): Don't leave an "opening..."
index a171cb35ae405ff164eb2faeec7a132eef2d51c7..8c9c984ba2eef110d19eac654e2741b78b2532ed 100644 (file)
@@ -365,7 +365,7 @@ Valid types include `google', `dejanews', and `gmane'.")
                               (match-string 1)
                               (match-string 2)
                               (or (match-string 3)
-                                  (substring (current-time-string) -4)))
+                                  (format-time-string "%Y")))
                     (current-time-string)))
        (setq From (match-string 4)))
       (widen)
index 7c95f47e0fb4e3daee0ace11e27b538c2474c927..82329677643a19c02b146bdc2508999b898a7ca0 100644 (file)
@@ -396,7 +396,7 @@ write-date, checksum, link-type, and link-name."
 
 (defun tar-clip-time-string (time)
   (let ((str (current-time-string time)))
-    (concat " " (substring str 4 16) (substring str 19 24))))
+    (concat " " (substring str 4 16) (format-time-string " %Y" time))))
 
 (defun tar-grind-file-mode (mode)
   "Construct a `-rw--r--r--' string indicating MODE.
index c7fa5927e48724fe3522f433c8831a07099c7f6b..8d43b565416e64391303a4e5785b685fb40145a0 100644 (file)
@@ -465,7 +465,7 @@ update which can wait for the next redisplay."
          (seconds (substring time 17 19))
          (time-zone (car (cdr (current-time-zone now))))
          (day (substring time 8 10))
-         (year (substring time 20 24))
+         (year (format-time-string "%Y" now))
          (monthname (substring time 4 7))
          (month
           (cdr