Timestamp.st
changeset 1701 80d13adb2e77
parent 1669 4951596746f7
child 2311 88b035dd471a
--- a/Timestamp.st	Tue Oct 08 20:32:31 1996 +0200
+++ b/Timestamp.st	Tue Oct 08 20:34:08 1996 +0200
@@ -150,53 +150,57 @@
      Notice, that this is not the storeString format and 
      is different from the format expected by readFrom:."
 
-    |str day month year hour min sec millis ex|
-
-    str := aStringOrStream readStream.
+    ErrorSignal handle:[:ex |
+        ^ exceptionBlock value
+    ] do:[
+        |str day month year hour min sec millis ex|
 
-    ex := [^ exceptionBlock value].
-    day := Integer readFrom:str onError:ex.
-    (day between:1 and:31) ifFalse:[^ exceptionBlock value].
+        str := aStringOrStream readStream.
+
+        ex := [^ exceptionBlock value].
+        day := Integer readFrom:str onError:ex.
+        (day between:1 and:31) ifFalse:[^ exceptionBlock value].
 
-    [str peek isDigit] whileFalse:[str next].
-    month := Integer readFrom:str onError:ex.
-    (month between:1 and:12) ifFalse:[^ exceptionBlock value].
+        [str peek isDigit] whileFalse:[str next].
+        month := Integer readFrom:str onError:ex.
+        (month between:1 and:12) ifFalse:[^ exceptionBlock value].
 
-    [str peek isDigit] whileFalse:[str next].
-    year := Integer readFrom:str onError:ex.
+        [str peek isDigit] whileFalse:[str next].
+        year := Integer readFrom:str onError:ex.
 
-    [str peek isDigit] whileFalse:[str next].
-    hour := Integer readFrom:str onError:ex.
-    (hour between:0 and:24) ifFalse:[^ exceptionBlock value].
+        [str peek isDigit] whileFalse:[str next].
+        hour := Integer readFrom:str onError:ex.
+        (hour between:0 and:24) ifFalse:[^ exceptionBlock value].
 
-    [str peek isDigit] whileFalse:[str next].
-    min := Integer readFrom:str onError:ex.
-    (min between:0 and:59) ifFalse:[^ exceptionBlock value].
+        [str peek isDigit] whileFalse:[str next].
+        min := Integer readFrom:str onError:ex.
+        (min between:0 and:59) ifFalse:[^ exceptionBlock value].
 
-    [str peek isDigit] whileFalse:[str next].
-    sec := Integer readFrom:str onError:ex.
-    (sec between:0 and:59) ifFalse:[^ exceptionBlock value].
+        [str peek isDigit] whileFalse:[str next].
+        sec := Integer readFrom:str onError:ex.
+        (sec between:0 and:59) ifFalse:[^ exceptionBlock value].
 
-    str peek = '.' ifTrue:[
-        str next.
-        millis := Integer readFrom:str onError:ex.
-    ] ifFalse:[
-        millis := 0.
-    ].
+        str peek = '.' ifTrue:[
+            str next.
+            millis := Integer readFrom:str onError:ex.
+        ] ifFalse:[
+            millis := 0.
+        ].
 
-    "special check"
-    hour == 24 ifTrue:[
-        (min ~~ 0 or:[sec ~~ 0]) ifTrue:[^ exceptionBlock value].
+        "special check"
+        hour == 24 ifTrue:[
+            (min ~~ 0 or:[sec ~~ 0]) ifTrue:[^ exceptionBlock value].
+        ].
+
+        ^ self day:day month:month year:year hour:hour minutes:min seconds:sec
     ].
 
-    ^ self day:day month:month year:year hour:hour minutes:min seconds:sec
-
     "
      AbsoluteTime readFrom:'20-2-1995 13:11:06'    
      AbsoluteTime readFrom:'20-2-1995 13:11:06.100'    
     "
 
-    "Modified: 1.7.1996 / 14:44:09 / cg"
+    "Modified: 8.10.1996 / 19:25:59 / cg"
 ! !
 
 !AbsoluteTime methodsFor:'accessing'!
@@ -648,5 +652,5 @@
 !AbsoluteTime  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.29 1996-09-20 07:27:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.30 1996-10-08 18:33:36 cg Exp $'
 ! !