GNU bug report logs - #26261
~N mishandles small nanoseconds value

Previous Next

Package: guile;

Reported by: Zefram <zefram <at> fysh.org>

Date: Sun, 26 Mar 2017 02:20:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> igalia.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Zefram <zefram <at> fysh.org>
Subject: bug#26261: closed (Re: bug#26261: ~N mishandles small nanoseconds
 value)
Date: Wed, 19 Apr 2017 13:15:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#26261: ~N mishandles small nanoseconds value

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 26261 <at> debbugs.gnu.org.

-- 
26261: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26261
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Andy Wingo <wingo <at> igalia.com>
To: Andrew Moss <andrewmoss <at> pobox.com>
Cc: 26261-done <at> debbugs.gnu.org
Subject: Re: bug#26261: ~N mishandles small nanoseconds value
Date: Wed, 19 Apr 2017 15:14:01 +0200
On Mon 27 Mar 2017 18:06, Andrew Moss <andrewmoss <at> pobox.com> 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 <andrewmoss <at> pobox.com>
> 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 <zefram <at> 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.

Applied.  Thank you very very much for the fix!

Andy

[Message part 3 (message/rfc822, inline)]
From: Zefram <zefram <at> fysh.org>
To: bug-guile <at> gnu.org
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



This bug report was last modified 8 years and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.