diff --git a/module/srfi/srfi-19.scm b/module/srfi/srfi-19.scm index 795ad50a9..1b795f380 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 d63e62222..534cd7ca0 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))