From: Paul Eggert Date: Sun, 26 Aug 2018 02:03:26 +0000 (-0700) Subject: Improve format-seconds accuracy X-Git-Tag: emacs-27.0.90~4511 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0edf60583245cc6f3fd53ddae2f21748a4a1b239;p=emacs.git 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. --- 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 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 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." (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)