diff options
author | Mark H Weaver <mhw@netris.org> | 2018-10-21 19:21:47 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2018-10-21 19:25:45 -0400 |
commit | 437e1aa03659b77a8eb4b5c6d2b104c03d038564 (patch) | |
tree | 884e6e2e1fa617c0f90fbc22f06525ab6d62feb5 /test-suite | |
parent | bbe6daa769e183a41909e345412af73c6d2561ec (diff) |
SRFI-19: Fix normalization of seconds and nanoseconds in time records.
Fixes <https://bugs.gnu.org/26162>.
Reported by Zefram <zefram@fysh.org>.
* module/srfi/srfi-19.scm (time-normalize!): Rewrite.
* test-suite/tests/srfi-19.test: Add tests.
Diffstat (limited to 'test-suite')
-rw-r--r-- | test-suite/tests/srfi-19.test | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test-suite/tests/srfi-19.test b/test-suite/tests/srfi-19.test index 0f1c33352..4d79f1043 100644 --- a/test-suite/tests/srfi-19.test +++ b/test-suite/tests/srfi-19.test @@ -206,6 +206,14 @@ incomplete numerical tower implementation.)" (test-time-arithmetic add-duration time1 diff time2) (test-time-arithmetic subtract-duration time2 diff time1)) + (with-test-prefix "nanosecond normalization" + (pass-if "small positive duration" + (time-equal? (make-time time-duration 999999000 0) + (time-difference (make-time time-tai 0 1) (make-time time-tai 1000 0)))) + (pass-if "small negative duration" + (time-equal? (make-time time-duration -999999000 0) + (time-difference (make-time time-tai 1000 0) (make-time time-tai 0 1))))) + (with-test-prefix "date->time-tai" ;; leap second 1 Jan 1999, 1 second of UTC in make-date is out as 2 ;; seconds of TAI in date->time-tai |