summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/arc-mode.el5
-rw-r--r--lisp/autoinsert.el6
-rw-r--r--lisp/calc/calc-forms.el2
-rw-r--r--lisp/emacs-lisp/copyright.el7
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/nnweb.el2
-rw-r--r--lisp/tar-mode.el2
-rw-r--r--lisp/time.el2
9 files changed, 30 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d57d93a7060..7d7cf56cd77 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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)
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 8b17208983f..c776a3f8b5c 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -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."
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index de2835580c2..e7639b6f8a3 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -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
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index 96cc74f7ef6..dfc5dfc6588 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -444,7 +444,7 @@
(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)
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 09b456b54ba..8e96d95c5dd 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -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)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 4938336742a..9000ccb9fef 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -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..."
diff --git a/lisp/gnus/nnweb.el b/lisp/gnus/nnweb.el
index a171cb35ae4..8c9c984ba2e 100644
--- a/lisp/gnus/nnweb.el
+++ b/lisp/gnus/nnweb.el
@@ -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)
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 7c95f47e0fb..82329677643 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -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.
diff --git a/lisp/time.el b/lisp/time.el
index c7fa5927e48..8d43b565416 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -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