# HG changeset patch # User Claus Gittinger # Date 1525993810 -7200 # Node ID ac18d6513ef8b7f95c780e510068f561f1ccc3f2 # Parent 0401fecb9c892bc13354615ba7e387312f9fc964 #BUGFIX by cg class: TimeDuration changed: #setNanoseconds: diff -r 0401fecb9c89 -r ac18d6513ef8 TimeDuration.st --- a/TimeDuration.st Fri May 11 00:03:47 2018 +0200 +++ b/TimeDuration.st Fri May 11 01:10:10 2018 +0200 @@ -2089,20 +2089,25 @@ setNanoseconds:nanos "set my duration given nanoseconds." - |restNanos| + |millis restNanos| + millis := nanos // (1000*1000). nanos isInteger ifTrue:[ - timeEncoding := nanos // 1000000. - additionalPicoseconds := (nanos \\ 1000) * 1000 + timeEncoding := millis. + restNanos := nanos \\ (1000*1000). + additionalPicoseconds := restNanos * 1000 ] ifFalse:[ - timeEncoding := nanos // (1000*1000). - restNanos := nanos - (timeEncoding * (1000*1000)). + timeEncoding := millis. + restNanos := nanos - (millis * (1000*1000)). additionalPicoseconds := (restNanos * 1000) rounded asInteger. ]. " self new setMicroseconds:4 self new setNanoseconds:4 + self new setNanoseconds:4000 + self new setNanoseconds:4000000 + self new setNanoseconds:40000000 self new setNanoseconds:0.1 "