#BUGFIX by cg
class: TimeDuration
added: #asPicoseconds
removed: #asPicoeconds
class: TimeDuration class
changed: #readFrom:defaultUnit:onError:
--- a/TimeDuration.st Thu May 10 01:52:41 2018 +0200
+++ b/TimeDuration.st Thu May 10 02:01:02 2018 +0200
@@ -308,13 +308,23 @@
mantissa := Number readMantissaAndScaleFrom:str radix:10.
fraction := (mantissa at:2) / (10 raisedTo:(mantissa at:3)).
- millis := (fraction * 1000) rounded.
+ (mantissa at:3) > 3 ifTrue:[
+ picos := fraction * (1000 * 1000 * 1000 * 1000).
+ millis := picos // (1000 * 1000 * 1000).
+ picos := picos \\ (1000 * 1000 * 1000).
+ ] ifFalse:[
+ millis := fraction * 1000.
+ ].
] ifFalse:[
millis := 0
].
]
].
- ^ self fromMilliseconds:(seconds*1000+millis) rounded asInteger.
+ t1 := self fromMilliseconds:(seconds*1000+millis).
+ picos notNil ifTrue:[
+ t1 additionalPicoseconds:picos
+ ].
+ ^ t1
].
((str peek == $.) or:[(str peek == $,)]) ifTrue:[
str next.
@@ -1042,7 +1052,7 @@
"Modified: / 21-09-2017 / 18:57:57 / cg"
!
-asPicoeconds
+asPicoseconds
"answer the duration as picoseconds (truncated)."
^ self getPicoseconds