summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-12-19 12:57:25 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2018-12-19 13:01:42 -0800
commit5bd6074415e8d572931ee51112d9b70b70e2ba55 (patch)
tree197616a9cf72bd188a9201274f0840afac93fac2 /lisp/calendar
parent3fa8bdca88153ff442ca22d8c298525c1b716e7e (diff)
downloademacs-5bd6074415e8d572931ee51112d9b70b70e2ba55.tar.gz
emacs-5bd6074415e8d572931ee51112d9b70b70e2ba55.tar.bz2
emacs-5bd6074415e8d572931ee51112d9b70b70e2ba55.zip
Minor fixes/simplifications to time functions
* doc/lispintro/emacs-lisp-intro.texi (Files List): Simplify. * doc/lispref/os.texi (Time of Day): Mention format-time-string as an alternative to current-time-string. * lisp/arc-mode.el (archive-unixdate, archive-unixtime): Port better to future versions of Emacs where (COUNT . HZ) will take precedence to (HI . LO). * lisp/arc-mode.el (archive-unixtime): * lisp/calendar/todo-mode.el (todo-insert-item--basic) (todo-item-done, todo-read-time): Prefer format-time-string to substringing current-time-string. * lisp/calc/calc-forms.el (calc-time, calcFunc-now): Prefer decode-time to parsing the output of current-time-string. * lisp/emacs-lisp/cl-extra.el (cl--random-time): Prefer encode-time to hashing the output of current-time-string. * lisp/gnus/gnus-score.el (gnus-score-headers) (gnus-score-adaptive): Avoid stringifying and then reparsing timestamp. * src/timefns.c (Fencode_time): Omit redundant assignment.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/todo-mode.el7
1 files changed, 3 insertions, 4 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 41fe57e60ce..145cf78e6de 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1931,7 +1931,7 @@ their associated keys and their effects."
(calendar-current-date) t t))))
(time-string (or (and time (todo-read-time))
(and todo-always-add-time-string
- (substring (current-time-string) 11 16)))))
+ (format-time-string "%H:%M")))))
(setq todo-date-from-calendar nil)
(find-file-noselect file 'nowarn)
(set-window-buffer (selected-window)
@@ -2881,8 +2881,7 @@ visible."
(not marked))
(let* ((date-string (calendar-date-string (calendar-current-date) t t))
(time-string (if todo-always-add-time-string
- (concat " " (substring (current-time-string)
- 11 16))
+ (format-time-string " %H:%M")
""))
(done-prefix (concat "[" todo-done-string date-string time-string
"] "))
@@ -6091,7 +6090,7 @@ the empty string (i.e., no time string)."
(while (not valid)
(setq answer (read-string "Enter a clock time: " nil nil
(when todo-always-add-time-string
- (substring (current-time-string) 11 16))))
+ (format-time-string "%H:%M"))))
(when (or (string= "" answer)
(string-match diary-time-regexp answer))
(setq valid t)))