1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

25 commits

Author SHA1 Message Date
Daniel Llorens
1b0fcddba5 Fix tests for SRFI-19 date->string ~N 2019-05-23 17:14:29 +02:00
Daniel Llorens
347ec3f088 Support ~N in SRFI-19 string->date
* module/srfi/srfi-19.scm (fractional-integer-reader,
  make-fractional-integer-reader): From reference implementation.
  (reader-directives): Handle #\N, from reference implementation.
* test-suite/tests/srfi-19: Add tests for string->date ~N.
* doc/ref/srfi-modules.texi (string->date): Add line for ~N.
2019-05-23 17:14:27 +02:00
Mark H Weaver
0389c59bd4 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.
2019-05-23 17:13:09 +02:00
Mark H Weaver
8361d59d1c SRFI-19: Add a few more tests.
This is a followup to commit a58c7abd72.

* test-suite/tests/srfi-19.test: Add tests for large positive years.
2019-05-23 17:13:07 +02:00
Mark H Weaver
db78033cc1 SRFI-19: Fix handling of negative years and negative julian days.
Fixes <https://bugs.gnu.org/21906>.
Mitigates <https://bugs.gnu.org/21903> and <https://bugs.gnu.org/21904>.
Reported by: Zefram <zefram@fysh.org>.

* module/srfi/srfi-19.scm (encode-julian-day-number)
(decode-julian-day-number, date-week-number): Use 'floor-quotient'
instead of 'quotient', and 'floor' instead of 'truncate', where
appropriate.
(time-utc->date): Ensure that the 'nanoseconds' field of the returned
date is non-negative.
(leap-year): Handle negative years properly, and reformulate the
computation.
(week-day): Handle negative years properly.  Use 'floor-quotient'
instead of 'quotient' where appropriate.
(directives): In the handler for '~Y' format escapes, improve the
handling of years outside of the range 0-9999.
(read-directives): Add a FIXME comment to fix the '~Y' reader to handle
years outside of the range 0-9999.
* test-suite/tests/srfi-19.test: Import (srfi srfi-1).  Use Guile's
modern keyword notation in the 'define-module' form.  Add more tests.
2019-05-23 17:13:05 +02:00
Mark H Weaver
e00563492a SRFI-19: Fix TAI->UTC conversions, leap second handling, etc.
Fixes <https://bugs.gnu.org/21911>.
Fixes <https://bugs.gnu.org/22034>.
Fixes <https://bugs.gnu.org/21902>.
Partially fixes <https://bugs.gnu.org/21904>.
Reported by Zefram <zefram@fysh.org>.

* doc/ref/srfi-modules.texi (SRFI-19 Introduction): Fix the definitions
of Julian Day and Modified Julian Day.  Give the correct full names of
UTC and TAI.
* module/srfi/srfi-19.scm: Import (srfi srfi-1).  Use modern Guile
keyword syntax in the 'define-module' form.
(leap-second-neg-delta): New procedure, derived from a similar procedure
in the latest upstream SRFI-19 reference implementation.
(priv:time-tai->time-utc!, time-tai->julian-day)
(time-monotonic->julian-day): Use 'leap-second-neg-delta'.
(local-tz-offset): Fix comment.
(leap-second?): Remove.
(tai-before-leap-second?): New procedure, derived from upstream SRFI-19.
(time-utc->date): Use 'define*' to handle the optional argument.  Remove
the leap second handling, following upstream SRFI-19.
(time-tai->date): Rewrite in terms of 'time-utc->date'.  Add special
leap second handling, following upstream SRFI-19.
(time-monotonic->date): Rewrite in terms of 'time-tai->date'.
(date->time-tai, date->time-monotonic): Add special leap second
handling, following upstream SRFI-19.
(directives): In the entry for the "~Y" escape in 'date->string', pad
the year field to 4 characters, following upstream SRFI-19.
* test-suite/tests/srfi-19.test: Add tests.
2019-05-23 17:13:03 +02:00
Andy Wingo
e264860718 Add srfi-19 ~f regression test
* test-suite/tests/srfi-19.test ("SRFI date/time library"): Add test for
  https://bugs.gnu.org/26259.
2017-04-19 15:49:06 +02:00
Andy Wingo
4b39c1a9e5 Fix date->string ~f operator to not emit leading zeros
* module/srfi/srfi-19.scm (directives): Format ~f without leading
  zeroes.  Fixes https://bugs.gnu.org/26260.
* test-suite/tests/srfi-19.test ("SRFI date/time library"): Add test.
2017-04-19 15:42:03 +02:00
Andrew Moss
1978085b22 Fixed bug: ~N mishandles small nanoseconds value
Fixes <http://bugs.gnu.org/26261>.
Reported by Zefram <zefram@fysh.org>.

* module/srfi/srfi-19.scm ("define directives"): N padding increased from 7 to 9

* test-suite/tests/srfi-19.test ("date->string"): New test.
2017-04-19 15:13:09 +02:00
Mark H Weaver
0ce224594a Improve handling of locales in the test suite.
* test-suite/guile-test (run-tests): Load each test file within
  (with-locale "C" ...).

* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/srfi-14.test: Remove broken code to save and restore
  the previous locale.

* test-suite/tests/bytevectors.test:
* test-suite/tests/format.test:
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-19.test:
* test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before
  calling it.
2014-02-07 21:49:35 -05:00
Ludovic Courtès
4c35b9f31c Have srfi-19.test' use the non-deprecated format' style.
* test-suite/tests/srfi-19.test: Fix all uses of `format' to pass a port
  or Boolean as the first argument.
2011-01-29 21:46:44 +01:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
8891556e50 srfi-19: Fix `string->date' weekday lookup.
* srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Use
  `locale-day-short' since it expects integers in the range 1-7, unlike
  `priv:locale-abbr-weekday'.
  (priv:locale-long-weekday->index): Likewise.

* test-suite/tests/srfi-19.test ("SRFI date/time
  library")["string->date works on Sunday"]: New test.
2008-12-18 22:49:13 +01:00
Ludovic Courtès
0867f7baa8 Changes from arch/CVS synchronization 2007-07-09 16:47:56 +00:00
Ludovic Courtès
c122500a28 Changes from arch/CVS synchronization 2007-05-09 21:14:49 +00:00
Ludovic Courtès
a7db552243 Changes from arch/CVS synchronization 2007-05-09 20:18:31 +00:00
Ludovic Courtès
a2f00b9b36 Changes from arch/CVS synchronization 2007-01-31 20:58:20 +00:00
Kevin Ryde
6e7d5622ee merge from 1.8 branch 2006-04-16 23:37:40 +00:00
Kevin Ryde
c992cc9617 (date->time-tai): New tests, exercising new leap-second. 2005-08-18 23:51:02 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Kevin Ryde
cd6f7d0bd2 Use #:duplicates (last) to
suppress warnings about current-time and raise replacing core bindings.
2004-07-23 23:41:35 +00:00
Kevin Ryde
957f3c2b6c (test-dst, string->date local DST): Test with
"EST5EDT" instead of "CET", since HP-UX doesn't know CET.
2004-05-09 00:49:25 +00:00
Kevin Ryde
01dbf76f90 (date-week-number): Add tests. 2003-08-22 22:30:52 +00:00
Thien-Thi Nguyen
176d0e0bfd (test-time-comparision, test-time-arithmatic): New procs.
Add time comparison tests using new procs.
Thanks to Alex Shinn.
2001-08-25 19:08:50 +00:00
Marius Vollmer
025f75b48f New files. Thanks to Matthias Köppe! 2001-06-16 20:11:39 +00:00