aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2018-08-25 19:03:26 -0700
committerPaul Eggert2018-08-25 19:57:01 -0700
commit0edf60583245cc6f3fd53ddae2f21748a4a1b239 (patch)
treec18b6cdd83230d9d1f248189dbd55c431c4f8747
parent2daf8b7e55698cc58f9b0a82aac591f957041cc6 (diff)
downloademacs-0edf60583245cc6f3fd53ddae2f21748a4a1b239.tar.gz
emacs-0edf60583245cc6f3fd53ddae2f21748a4a1b239.zip
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.
-rw-r--r--doc/lispref/os.texi4
-rw-r--r--lisp/calendar/time-date.el1
2 files changed, 1 insertions, 4 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index adf554e8436..c48d08490fd 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1681,10 +1681,6 @@ You can also specify the field width by following the @samp{%} with a
1681number; shorter numbers will be padded with blanks. An optional 1681number; shorter numbers will be padded with blanks. An optional
1682period before the width requests zero-padding instead. For example, 1682period before the width requests zero-padding instead. For example,
1683@code{"%.3Y"} might produce @code{"004 years"}. 1683@code{"%.3Y"} might produce @code{"004 years"}.
1684
1685@emph{Warning:} This function works only with values of @var{seconds}
1686that don't exceed @code{most-positive-fixnum} (@pxref{Integer Basics,
1687most-positive-fixnum}).
1688@end defun 1684@end defun
1689 1685
1690@node Processor Run Time 1686@node Processor Run Time
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index 467915e3d9f..74c607ccb68 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -303,6 +303,7 @@ is output until the first non-zero unit is encountered."
303 (push match usedunits))) 303 (push match usedunits)))
304 (and zeroflag larger 304 (and zeroflag larger
305 (error "Units are not in decreasing order of size")) 305 (error "Units are not in decreasing order of size"))
306 (setq seconds (floor seconds))
306 (dolist (u units) 307 (dolist (u units)
307 (setq spec (car u) 308 (setq spec (car u)
308 name (cadr u) 309 name (cadr u)