SRFI-19's ~f specifier is broken in interesting ways
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Scheme Libraries |
New
|
High
|
Unassigned |
Bug Description
Ikarus Scheme version 0.0.4-rc1+ (revision 1870, build 2010-06-19)
Copyright (c) 2006-2009 Abdulaziz Ghuloum
> (import (srfi :19 time))
> (date->string (make-date 42 59 59 23 20 6 2010 0) "~4 ~f") ;weird
"2010-06-
> (date->string (make-date 555000000 59 59 12 20 6 2010 0) "~4 ~f") ;weird
"2010-06-
> (date->string (make-date 90000000 59 59 23 20 6 2010 0) "~4 ~f") ;bad
Unhandled exception
Condition components:
1. &assertion
2. &who: +
3. &message: "not a number"
4. &irritants: (#f)
>
The last one seems to happen when the nanosecond field is less than 100 000 000 and has a single non-zero digit.
One way to fix all these is perhaps to convert the nanoseconds (modulo something?) to a string (take the leftmost 9(?) characters), which is then padded and trimmed.
Tested with lp:~scheme-libraries-team/scheme-libraries/srfi revno 95.
I think this is a problem with the reference implementation. I don't have the time, or even my own computer anymore, to work on fixing it. I'm happy to apply anyone's patch which fixes it.