Commit 0bfcf5c5 authored by Paul Eggert's avatar Paul Eggert

Fix minor Y10k bugs.

* 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.
parent 85e8b518
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)
......
......@@ -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."
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
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..."
......
......@@ -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)
......
......@@ -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.
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment