diff options
| -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) |