diff options
| author | Paul Eggert | 2018-08-25 19:03:26 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-25 19:57:01 -0700 |
| commit | 0edf60583245cc6f3fd53ddae2f21748a4a1b239 (patch) | |
| tree | c18b6cdd83230d9d1f248189dbd55c431c4f8747 | |
| parent | 2daf8b7e55698cc58f9b0a82aac591f957041cc6 (diff) | |
| download | emacs-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.texi | 4 | ||||
| -rw-r--r-- | lisp/calendar/time-date.el | 1 |
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 | |||
| 1681 | number; shorter numbers will be padded with blanks. An optional | 1681 | number; shorter numbers will be padded with blanks. An optional |
| 1682 | period before the width requests zero-padding instead. For example, | 1682 | period 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} | ||
| 1686 | that don't exceed @code{most-positive-fixnum} (@pxref{Integer Basics, | ||
| 1687 | most-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) |