Timestamp.st
changeset 22653 e7112f73582e
parent 22627 2b4c63a427fb
child 22827 9ea9757226e5
--- a/Timestamp.st	Fri Mar 23 14:21:15 2018 +0100
+++ b/Timestamp.st	Fri Mar 23 14:36:06 2018 +0100
@@ -1191,7 +1191,7 @@
 
 
     ^ [
-        |newTime str day month year hour min sec millis c|
+        |newTime str day month year hour min sec millis c fraction|
 
         sec := millis := 0.
         str := aStringOrStream readStream.
@@ -1226,7 +1226,16 @@
             str atEnd ifFalse:[
                 str peek == $. ifTrue:[
                     str next.
-                    millis := Integer readFrom:str.
+                    "/ the old code here was wrong in assuming that exactly 3 digits
+                    "/ are coming; thus hh:mm:ss.1 was interpreted as 1ms (instead of 100)
+                    "/ thus: count the zeros...
+                    str peek isDigit ifTrue:[
+                        fraction := Number readMantissaFrom:str radix:10.
+                        fraction isNil ifTrue:[^ exceptionBlock value].
+                        millis := (fraction * 1000) rounded.
+                    ] ifFalse:[
+                        millis := 0
+                    ].
                 ].
                 str skipSeparators.
             ].