diff options
| author | Paul Eggert | 2019-08-17 15:39:18 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-08-17 15:43:05 -0700 |
| commit | c90a420779448fecf1941f063da3e8276dc3d0d7 (patch) | |
| tree | 691868a02f1e99ee4e3e058b23836501d3f0ffad | |
| parent | 6616806896060d95355c965599517d7065c19b86 (diff) | |
| download | emacs-c90a420779448fecf1941f063da3e8276dc3d0d7.tar.gz emacs-c90a420779448fecf1941f063da3e8276dc3d0d7.zip | |
Add FIXMEs for subsecond support
This adds FIXMEs to areas where Lisp code should support
subsecond information in broken-down timestamps.
It also fixes some unnecessary truncation of timestamps, and
ports the code to a hypothetical future Emacs version where
(decode-time) returns subsecond timestamps by default.
* lisp/calc/calc-forms.el (calc-time, math-iso-dt-to-date)
(calcFunc-now):
* lisp/calendar/icalendar.el (icalendar--add-decoded-times):
* lisp/calendar/iso8601.el (iso8601-parse-interval):
Truncate seconds to an integer, and add a FIXME about
subseconds support.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime)
(icalendar--decode-isoduration):
Add a FIXME about subseconds support.
* lisp/gnus/gnus-delay.el (gnus-delay-article):
Don’t truncate seconds to an integer, as there’s no need
to do that here.
* lisp/gnus/gnus-util.el (gnus-seconds-today)
(gnus-seconds-month, gnus-seconds-year):
* lisp/gnus/message.el (message-make-expires-date):
* lisp/org/org-timer.el (org-timer-show-remaining-time):
* lisp/vc/ediff-mult.el (ediff-format-date):
Truncate seconds to an integer, as that’s what’s wanted here.
* lisp/midnight.el (midnight-next):
Ceiling seconds to an integer, as that’s what wanted here.
| -rw-r--r-- | lisp/calc/calc-forms.el | 8 | ||||
| -rw-r--r-- | lisp/calendar/icalendar.el | 9 | ||||
| -rw-r--r-- | lisp/calendar/iso8601.el | 3 | ||||
| -rw-r--r-- | lisp/gnus/gnus-delay.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-util.el | 12 | ||||
| -rw-r--r-- | lisp/gnus/message.el | 2 | ||||
| -rw-r--r-- | lisp/midnight.el | 4 | ||||
| -rw-r--r-- | lisp/org/org-timer.el | 3 | ||||
| -rw-r--r-- | lisp/vc/ediff-mult.el | 3 |
9 files changed, 28 insertions, 18 deletions
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index c410ffe449c..7e8a8dcc9d0 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | (defun calc-time () | 37 | (defun calc-time () |
| 38 | (interactive) | 38 | (interactive) |
| 39 | (calc-wrapper | 39 | (calc-wrapper |
| 40 | (let ((time (decode-time))) | 40 | (let ((time (decode-time nil nil 'integer))) ;; FIXME: Support subseconds. |
| 41 | (calc-enter-result 0 "time" | 41 | (calc-enter-result 0 "time" |
| 42 | (list 'mod | 42 | (list 'mod |
| 43 | (list 'hms | 43 | (list 'hms |
| @@ -499,7 +499,8 @@ in the Gregorian calendar and the remaining part determines the time." | |||
| 499 | (math-add (math-float date) | 499 | (math-add (math-float date) |
| 500 | (math-div (math-add (+ (* (nth 3 dt) 3600) | 500 | (math-div (math-add (+ (* (nth 3 dt) 3600) |
| 501 | (* (nth 4 dt) 60)) | 501 | (* (nth 4 dt) 60)) |
| 502 | (nth 5 dt)) | 502 | ;; FIXME: Support subseconds. |
| 503 | (time-convert (nth 5 dt) 'integer)) | ||
| 503 | '(float 864 2))) | 504 | '(float 864 2))) |
| 504 | date))) | 505 | date))) |
| 505 | 506 | ||
| @@ -1327,7 +1328,8 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." | |||
| 1327 | (math-parse-iso-date-validate isoyear isoweek isoweekday hour minute second))))) | 1328 | (math-parse-iso-date-validate isoyear isoweek isoweekday hour minute second))))) |
| 1328 | 1329 | ||
| 1329 | (defun calcFunc-now (&optional zone) | 1330 | (defun calcFunc-now (&optional zone) |
| 1330 | (let ((date (let ((now (decode-time))) | 1331 | ;; FIXME: Support subseconds. |
| 1332 | (let ((date (let ((now (decode-time nil nil 'integer))) | ||
| 1331 | (list 'date (math-dt-to-date | 1333 | (list 'date (math-dt-to-date |
| 1332 | (list (decoded-time-year now) | 1334 | (list (decoded-time-year now) |
| 1333 | (decoded-time-month now) | 1335 | (decoded-time-month now) |
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index c2688705e30..3c46982c7b0 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -628,6 +628,7 @@ FIXME: multiple comma-separated values should be allowed!" | |||
| 628 | (when (> (length isodatetimestring) 14) | 628 | (when (> (length isodatetimestring) 14) |
| 629 | ;; seconds present | 629 | ;; seconds present |
| 630 | (setq second (read (substring isodatetimestring 13 15)))) | 630 | (setq second (read (substring isodatetimestring 13 15)))) |
| 631 | ;; FIXME: Support subseconds. | ||
| 631 | (when (and (> (length isodatetimestring) 15) | 632 | (when (and (> (length isodatetimestring) 15) |
| 632 | ;; UTC specifier present | 633 | ;; UTC specifier present |
| 633 | (char-equal ?Z (aref isodatetimestring 15))) | 634 | (char-equal ?Z (aref isodatetimestring 15))) |
| @@ -703,6 +704,7 @@ FIXME: multiple comma-separated values should be allowed!" | |||
| 703 | (setq minutes (read (substring isodurationstring | 704 | (setq minutes (read (substring isodurationstring |
| 704 | (match-beginning 10) | 705 | (match-beginning 10) |
| 705 | (match-end 10))))) | 706 | (match-end 10))))) |
| 707 | ;; FIXME: Support subseconds. | ||
| 706 | (if (match-beginning 11) | 708 | (if (match-beginning 11) |
| 707 | (setq seconds (read (substring isodurationstring | 709 | (setq seconds (read (substring isodurationstring |
| 708 | (match-beginning 12) | 710 | (match-beginning 12) |
| @@ -719,9 +721,12 @@ FIXME: multiple comma-separated values should be allowed!" | |||
| 719 | "Add TIME1 to TIME2. | 721 | "Add TIME1 to TIME2. |
| 720 | Both times must be given in decoded form. One of these times must be | 722 | Both times must be given in decoded form. One of these times must be |
| 721 | valid (year > 1900 or something)." | 723 | valid (year > 1900 or something)." |
| 722 | ;; FIXME: does this function exist already? | 724 | ;; FIXME: does this function exist already? Can we use decoded-time-add? |
| 723 | (decode-time (encode-time | 725 | (decode-time (encode-time |
| 724 | (+ (decoded-time-second time1) (decoded-time-second time2)) | 726 | ;; FIXME: Support subseconds. |
| 727 | (time-convert (time-add (decoded-time-second time1) | ||
| 728 | (decoded-time-second time2)) | ||
| 729 | 'integer) | ||
| 725 | (+ (decoded-time-minute time1) (decoded-time-minute time2)) | 730 | (+ (decoded-time-minute time1) (decoded-time-minute time2)) |
| 726 | (+ (decoded-time-hour time1) (decoded-time-hour time2)) | 731 | (+ (decoded-time-hour time1) (decoded-time-hour time2)) |
| 727 | (+ (decoded-time-day time1) (decoded-time-day time2)) | 732 | (+ (decoded-time-day time1) (decoded-time-day time2)) |
diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el index 30352c7e75f..0f42c824e32 100644 --- a/lisp/calendar/iso8601.el +++ b/lisp/calendar/iso8601.el | |||
| @@ -322,9 +322,10 @@ Return the number of minutes." | |||
| 322 | duration)))) | 322 | duration)))) |
| 323 | (list start end | 323 | (list start end |
| 324 | (or duration | 324 | (or duration |
| 325 | ;; FIXME: Support subseconds. | ||
| 325 | (decode-time (time-subtract (iso8601--encode-time end) | 326 | (decode-time (time-subtract (iso8601--encode-time end) |
| 326 | (iso8601--encode-time start)) | 327 | (iso8601--encode-time start)) |
| 327 | (or (decoded-time-zone end) 0)))))) | 328 | (or (decoded-time-zone end) 0) 'integer))))) |
| 328 | 329 | ||
| 329 | (defun iso8601--match (regexp string) | 330 | (defun iso8601--match (regexp string) |
| 330 | (string-match (concat "\\`" regexp "\\'") string)) | 331 | (string-match (concat "\\`" regexp "\\'") string)) |
diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el index aabf23924a0..512011fa73b 100644 --- a/lisp/gnus/gnus-delay.el +++ b/lisp/gnus/gnus-delay.el | |||
| @@ -98,7 +98,7 @@ DELAY is a string, giving the length of the time. Possible values are: | |||
| 98 | (setq hour (string-to-number (match-string 1 delay)) | 98 | (setq hour (string-to-number (match-string 1 delay)) |
| 99 | minute (string-to-number (match-string 2 delay))) | 99 | minute (string-to-number (match-string 2 delay))) |
| 100 | ;; Use current time, except... | 100 | ;; Use current time, except... |
| 101 | (setq deadline (decode-time)) | 101 | (setq deadline (decode-time nil nil t)) |
| 102 | ;; ... for minute and hour. | 102 | ;; ... for minute and hour. |
| 103 | (setq deadline (apply #'encode-time (car deadline) minute hour | 103 | (setq deadline (apply #'encode-time (car deadline) minute hour |
| 104 | (nthcdr 3 deadline))) | 104 | (nthcdr 3 deadline))) |
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index c6be59fd19f..f73af8e261c 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el | |||
| @@ -357,24 +357,24 @@ Symbols are also allowed; their print names are used instead." | |||
| 357 | ;; the full date if it's older) | 357 | ;; the full date if it's older) |
| 358 | 358 | ||
| 359 | (defun gnus-seconds-today () | 359 | (defun gnus-seconds-today () |
| 360 | "Return the number of seconds passed today." | 360 | "Return the integer number of seconds passed today." |
| 361 | (let ((now (decode-time))) | 361 | (let ((now (decode-time nil nil 'integer))) |
| 362 | (+ (decoded-time-second now) | 362 | (+ (decoded-time-second now) |
| 363 | (* (decoded-time-minute now) 60) | 363 | (* (decoded-time-minute now) 60) |
| 364 | (* (decoded-time-hour now) 3600)))) | 364 | (* (decoded-time-hour now) 3600)))) |
| 365 | 365 | ||
| 366 | (defun gnus-seconds-month () | 366 | (defun gnus-seconds-month () |
| 367 | "Return the number of seconds passed this month." | 367 | "Return the integer number of seconds passed this month." |
| 368 | (let ((now (decode-time))) | 368 | (let ((now (decode-time nil nil 'integer))) |
| 369 | (+ (decoded-time-second now) | 369 | (+ (decoded-time-second now) |
| 370 | (* (decoded-time-minute now) 60) | 370 | (* (decoded-time-minute now) 60) |
| 371 | (* (decoded-time-hour now) 3600) | 371 | (* (decoded-time-hour now) 3600) |
| 372 | (* (- (decoded-time-day now) 1) 3600 24)))) | 372 | (* (- (decoded-time-day now) 1) 3600 24)))) |
| 373 | 373 | ||
| 374 | (defun gnus-seconds-year () | 374 | (defun gnus-seconds-year () |
| 375 | "Return the number of seconds passed this year." | 375 | "Return the integer number of seconds passed this year." |
| 376 | (let* ((current (current-time)) | 376 | (let* ((current (current-time)) |
| 377 | (now (decode-time current)) | 377 | (now (decode-time current nil 'integer)) |
| 378 | (days (format-time-string "%j" current))) | 378 | (days (format-time-string "%j" current))) |
| 379 | (+ (decoded-time-second now) | 379 | (+ (decoded-time-second now) |
| 380 | (* (decoded-time-minute now) 60) | 380 | (* (decoded-time-minute now) 60) |
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 0a540a62214..48d79107ea8 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -5508,7 +5508,7 @@ If NOW, use that time instead." | |||
| 5508 | "Make date string for the Expires header. Expiry in DAYS days. | 5508 | "Make date string for the Expires header. Expiry in DAYS days. |
| 5509 | 5509 | ||
| 5510 | In posting styles use `(\"Expires\" (make-expires-date 30))'." | 5510 | In posting styles use `(\"Expires\" (make-expires-date 30))'." |
| 5511 | (let* ((cur (decode-time)) | 5511 | (let* ((cur (decode-time nil nil 'integer)) |
| 5512 | (nday (+ days (decoded-time-day cur)))) | 5512 | (nday (+ days (decoded-time-day cur)))) |
| 5513 | (setf (decoded-time-day cur) nday) | 5513 | (setf (decoded-time-day cur) nday) |
| 5514 | (message-make-date (encode-time cur)))) | 5514 | (message-make-date (encode-time cur)))) |
diff --git a/lisp/midnight.el b/lisp/midnight.el index fa41d80a69e..aad5236819d 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el | |||
| @@ -193,8 +193,8 @@ The default value is `clean-buffer-list'." | |||
| 193 | :type 'hook) | 193 | :type 'hook) |
| 194 | 194 | ||
| 195 | (defun midnight-next () | 195 | (defun midnight-next () |
| 196 | "Return the number of seconds till the next midnight." | 196 | "Return the number of whole or partial seconds till the next midnight." |
| 197 | (pcase-let ((`(,sec ,min ,hrs) (decode-time))) | 197 | (pcase-let ((`(,sec ,min ,hrs) (decode-time nil nil 'integer))) |
| 198 | (- (* 24 60 60) (* 60 60 hrs) (* 60 min) sec))) | 198 | (- (* 24 60 60) (* 60 60 hrs) (* 60 min) sec))) |
| 199 | 199 | ||
| 200 | ;;;###autoload | 200 | ;;;###autoload |
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index 6529a8b0ddf..20b33a1ef5f 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el | |||
| @@ -385,7 +385,8 @@ VALUE can be `on', `off', or `paused'." | |||
| 385 | (message "No timer set") | 385 | (message "No timer set") |
| 386 | (let* ((rtime (decode-time | 386 | (let* ((rtime (decode-time |
| 387 | (time-subtract (timer--time org-timer-countdown-timer) | 387 | (time-subtract (timer--time org-timer-countdown-timer) |
| 388 | nil))) | 388 | nil) |
| 389 | 'integer)) | ||
| 389 | (rsecs (nth 0 rtime)) | 390 | (rsecs (nth 0 rtime)) |
| 390 | (rmins (nth 1 rtime))) | 391 | (rmins (nth 1 rtime))) |
| 391 | (message "%d minute(s) %d seconds left before next time out" | 392 | (message "%d minute(s) %d seconds left before next time out" |
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el index 1bdaca268e5..66d14e6b06d 100644 --- a/lisp/vc/ediff-mult.el +++ b/lisp/vc/ediff-mult.el | |||
| @@ -1210,7 +1210,8 @@ behavior." | |||
| 1210 | (decoded-time-year time) | 1210 | (decoded-time-year time) |
| 1211 | (ediff-fill-leading-zero (decoded-time-hour time)) | 1211 | (ediff-fill-leading-zero (decoded-time-hour time)) |
| 1212 | (ediff-fill-leading-zero (decoded-time-minute time)) | 1212 | (ediff-fill-leading-zero (decoded-time-minute time)) |
| 1213 | (ediff-fill-leading-zero (decoded-time-second time)))) | 1213 | (ediff-fill-leading-zero (time-convert (decoded-time-second time) |
| 1214 | 'integer)))) | ||
| 1214 | 1215 | ||
| 1215 | ;; Draw the directories | 1216 | ;; Draw the directories |
| 1216 | (defun ediff-insert-dirs-in-meta-buffer (meta-list) | 1217 | (defun ediff-insert-dirs-in-meta-buffer (meta-list) |