Improve format-seconds accuracy

* doc/lispref/os.texi (Time Parsing): It works with bignums.
* lisp/calendar/time-date.el (format-seconds):
Take the floor so that the resulting arithmetic is exact.
This commit is contained in:
Paul Eggert 2018-08-25 19:03:26 -07:00
parent 2daf8b7e55
commit 0edf605832
2 changed files with 1 additions and 4 deletions

View file

@ -1681,10 +1681,6 @@ You can also specify the field width by following the @samp{%} with a
number; shorter numbers will be padded with blanks. An optional
period before the width requests zero-padding instead. For example,
@code{"%.3Y"} might produce @code{"004 years"}.
@emph{Warning:} This function works only with values of @var{seconds}
that don't exceed @code{most-positive-fixnum} (@pxref{Integer Basics,
most-positive-fixnum}).
@end defun
@node Processor Run Time

View file

@ -303,6 +303,7 @@ is output until the first non-zero unit is encountered."
(push match usedunits)))
(and zeroflag larger
(error "Units are not in decreasing order of size"))
(setq seconds (floor seconds))
(dolist (u units)
(setq spec (car u)
name (cadr u)