diff options
| author | Lars Ingebrigtsen | 2022-04-13 15:57:24 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-04-13 15:57:24 +0200 |
| commit | 0ef9f6d07b5abe60005bea3eb2bb6d9c3aafbb98 (patch) | |
| tree | b7672430aea11444b7b6fbf8f1f7ae37947839c9 | |
| parent | be42fdc6dc60bec1d14065d04dc43b693398c591 (diff) | |
| download | emacs-0ef9f6d07b5abe60005bea3eb2bb6d9c3aafbb98.tar.gz emacs-0ef9f6d07b5abe60005bea3eb2bb6d9c3aafbb98.zip | |
Fix format-seconds error in previous change
* lisp/calendar/time-date.el (format-seconds): Fix zero elision
when using fractional seconds.
| -rw-r--r-- | lisp/calendar/time-date.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index 0db973ea161..ba7c48b290d 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el | |||
| @@ -343,15 +343,18 @@ right of \"%x\", trailing zero units are not output." | |||
| 343 | ;; Cf article-make-date-line in gnus-art. | 343 | ;; Cf article-make-date-line in gnus-art. |
| 344 | (setq num (floor seconds unit) | 344 | (setq num (floor seconds unit) |
| 345 | seconds (- seconds (* num unit))) | 345 | seconds (- seconds (* num unit))) |
| 346 | ;; Start position of the first non-zero unit. | 346 | (let ((is-zero (zerop (if (= unit 1) |
| 347 | (when (and (not leading-zeropos) | 347 | (+ num fraction) |
| 348 | (not (zerop num))) | 348 | num)))) |
| 349 | (setq leading-zeropos (match-beginning 0))) | 349 | ;; Start position of the first non-zero unit. |
| 350 | (unless (zerop num) | 350 | (when (and (not leading-zeropos) |
| 351 | (setq trailing-zeropos nil)) | 351 | (not is-zero)) |
| 352 | (when (and (not trailing-zeropos) | 352 | (setq leading-zeropos (match-beginning 0))) |
| 353 | (zerop num)) | 353 | (unless is-zero |
| 354 | (setq trailing-zeropos (match-beginning 0))) | 354 | (setq trailing-zeropos nil)) |
| 355 | (when (and (not trailing-zeropos) | ||
| 356 | is-zero) | ||
| 357 | (setq trailing-zeropos (match-beginning 0)))) | ||
| 355 | (setq string | 358 | (setq string |
| 356 | (replace-match | 359 | (replace-match |
| 357 | (format (if (match-string 2 string) | 360 | (format (if (match-string 2 string) |