Re: SRFI 19 ~f bug

David Van Horn <[email protected]> Tue, 19 Jul 2005 10:11:44 -0400
Newsgroups gmane.lisp.scheme.plt.schematics
Message-ID <[email protected]>
Noel Welsh wrote:
> Thanks for the bug report.  It would be helpful it you
> could give the expected behaviour as well -- I can't keep
> up-to-date with all Schematics projects.

The description of "~f" is:
"seconds+fractional seconds, using locale's decimal separator (e.g. 5.2)."

There is no specification of the precision of the fractional seconds, so it 
seems the easiest implementation is to do the following, ie use all 9 digits 
available:

(string-append
   (string->number (date-seconds d))
   (locale-separator)
   (string-pad (string->number (date-nanoseconds d)) 9 #\0))

But any of the following would be fine according to the SRFI, as far as I can 
tell (assuming the locale decimal separator is "."):

(define d (time-utc->date (make-time time-utc 5290000 0)))
(date->string d "~f")
=>
"0.5"
"0.53"
"0.529"
"0.5290"
"0.52900"
...

PLT gives:
(date->string d "~f")
=>
"00.01-53-1"

However, there are numerous other problems with the SRFI reference 
implementation which have leaked over into the PLT version.  I'm going to 
rewrite it from scratch in hopes of fixing it once and for all, so don't worry 
about fixing this particular bug for the moment.

> PS: I'm about to commit your SRFI 60 impl to Schematics
> CVS.

Thanks.

David



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click