emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#26261: closed (~N mishandles small nanoseconds val


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#26261: closed (~N mishandles small nanoseconds value)
Date: Wed, 19 Apr 2017 13:15:02 +0000

Your message dated Wed, 19 Apr 2017 15:14:01 +0200
with message-id <address@hidden>
and subject line Re: bug#26261: ~N mishandles small nanoseconds value
has caused the debbugs.gnu.org bug report #26261,
regarding ~N mishandles small nanoseconds value
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
26261: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26261
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: ~N mishandles small nanoseconds value Date: Sun, 26 Mar 2017 03:19:24 +0100
The ~N format specifier in SRFI-19's date->string is documented to show
the nanoseconds value, with zero padding.  The documentation explicates
further by showing as an example a string of nine zeroes.  In fact the
implementation only pads to seven digits, and so produces incorrect
output for and nanoseconds value in the range [0, 100000000):

scheme@(guile-user)> (use-modules (srfi srfi-19))
scheme@(guile-user)> (date->string (make-date 0 5 34 12 26 3 2017 0) "~N")
$1 = "0000000"
scheme@(guile-user)> (date->string (make-date 2 5 34 12 26 3 2017 0) "~N")
$2 = "0000002"
scheme@(guile-user)> (date->string (make-date 200 5 34 12 26 3 2017 0) "~N")
$3 = "0000200"
scheme@(guile-user)> (date->string (make-date 200000 5 34 12 26 3 2017 0) "~N")
$4 = "0200000"
scheme@(guile-user)> (date->string (make-date 99999999 5 34 12 26 3 2017 0) 
"~N")
$5 = "99999999"
scheme@(guile-user)> (date->string (make-date 200000000 5 34 12 26 3 2017 0) 
"~N")
$6 = "200000000"

The padding clearly has to be to the full nine digits.

-zefram



--- End Message ---
--- Begin Message --- Subject: Re: bug#26261: ~N mishandles small nanoseconds value Date: Wed, 19 Apr 2017 15:14:01 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
On Mon 27 Mar 2017 18:06, Andrew Moss <address@hidden> writes:

> I believe I have fixed this bug, but I'm not sure if I put the test
> case in the right place within the file. Please see the attached
> patch.
>
> From e975f8ae8d494985a51faed5b15c5664a557e0e2 Mon Sep 17 00:00:00 2001
> From: Andrew Moss <address@hidden>
> Date: Mon, 27 Mar 2017 11:58:29 -0400
> Subject: [PATCH] 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.

Applied.  Thank you very very much for the fix!

Andy


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]