Re: Issue 2350 in pharo: Duration parsing nanos

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2350 in pharo: Duration parsing nanos

pharo
Updates:
        Status: Invalid

Comment #2 on issue 2350 by [hidden email]: Duration parsing nanos
http://code.google.com/p/pharo/issues/detail?id=2350

It doesn't seem to be a bug since in  hh:mm:ss.[0-9]+ the part after the  
second actually denotes the fractional part of the second and NOT the  
number of nanoseconds.

The code actually has a nanoseconds variable which is rather misleading but  
it actually does what it is supposed to do:

 From Time>>print24:showSeconds:on:

[(s + (self nanoSecond / NanosInSecond) asFloat) printOn: aStream]].

Now for '4:02:55.520 pm' self nanoSecond returns 520000000, which does the  
right thing in the above computation. The only reason it is used that way  
is because in smalltalk the fractional part of a second has accuracy up to  
nanoseconds so:

(Time readFrom: '4:02:55.99999999999999999999 pm' readStream) printString
does correctly give:

'4:02:55.999999999 pm' (fractional accuracy of nanoseconds)

so do the examples above since 0.520 == 0.52