[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/01: Fixed bug: ~N mishandles small nanoseconds value
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/01: Fixed bug: ~N mishandles small nanoseconds value |
Date: |
Wed, 19 Apr 2017 09:14:00 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 1978085b2208e71de5e7ba28582295c17c8053d5
Author: Andrew Moss <address@hidden>
Date: Mon Mar 27 11:58:29 2017 -0400
Fixed bug: ~N mishandles small nanoseconds value
Fixes <http://bugs.gnu.org/26261>.
Reported by Zefram <address@hidden>.
* module/srfi/srfi-19.scm ("define directives"): N padding increased from 7
to 9
* test-suite/tests/srfi-19.test ("date->string"): New test.
---
module/srfi/srfi-19.scm | 2 +-
test-suite/tests/srfi-19.test | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/module/srfi/srfi-19.scm b/module/srfi/srfi-19.scm
index 795ad50..1b795f3 100644
--- a/module/srfi/srfi-19.scm
+++ b/module/srfi/srfi-19.scm
@@ -1063,7 +1063,7 @@
(newline port)))
(cons #\N (lambda (date pad-with port)
(display (padding (date-nanosecond date)
- pad-with 7)
+ pad-with 9)
port)))
(cons #\p (lambda (date pad-with port)
(display (locale-am-string/pm (date-hour date)) port)))
diff --git a/test-suite/tests/srfi-19.test b/test-suite/tests/srfi-19.test
index d63e622..534cd7c 100644
--- a/test-suite/tests/srfi-19.test
+++ b/test-suite/tests/srfi-19.test
@@ -175,6 +175,11 @@ incomplete numerical tower implementation.)"
(equal? "Sun Jun 05 18:33:00+0200 2005"
(date->string date))))
+ (pass-if "date->string pads small nanoseconds values correctly"
+ (let* ((date (make-date 99999999 5 34 12 26 3 2017 0)))
+ (equal? "099999999"
+ (date->string date "~N"))))
+
;; check time comparison procedures
(let* ((time1 (make-time time-monotonic 0 0))
(time2 (make-time time-monotonic 0 0))