--- a/Time.st Mon Feb 22 21:15:57 1999 +0100
+++ b/Time.st Mon Feb 22 21:40:34 1999 +0100
@@ -88,30 +88,30 @@
If no am/pm follows the time, the string is interpreted as
either 24 hour format or being am."
+ |newTime|
+
ErrorSignal handle:[:ex |
^ exceptionBlock value
] do:[
- |str hour min sec ex|
+ |str hour min sec|
str := aStringOrStream readStream.
- ex := [^ exceptionBlock value].
-
- hour := Integer readFrom:str onError:ex.
- (hour between:0 and:24) ifFalse:[ex value].
+ hour := Integer readFrom:str.
+ (hour between:0 and:24) ifFalse:[^ exceptionBlock value].
min := 0.
sec := 0.
str atEnd ifFalse:[
(str peek == $:) ifTrue:[
str next.
- min := Integer readFrom:str onError:ex.
- (min between:0 and:59) ifFalse:[ex value].
+ min := Integer readFrom:str.
+ (min between:0 and:59) ifFalse:[^ exceptionBlock value].
(str peek == $:) ifTrue:[
str next.
- sec := Integer readFrom:str onError:ex.
- (sec between:0 and:59) ifFalse:[ex value].
+ sec := Integer readFrom:str.
+ (sec between:0 and:59) ifFalse:[^ exceptionBlock value].
].
].
[str peek == Character space] whileTrue:[str next].
@@ -120,8 +120,7 @@
(str peek == $m or:[str peek == $M]) ifTrue:[
str next
].
- hour > 12 ifTrue:[ex value].
- hour == 0 ifTrue:[ex value].
+ (hour <= 0 or:[hour > 12]) ifTrue:[^ exceptionBlock value].
"pm"
hour ~~ 12 ifTrue:[
@@ -133,15 +132,16 @@
(str peek == $m or:[str peek == $M]) ifTrue:[
str next
].
- hour >= 12 ifTrue:[ex value].
+ hour >= 12 ifTrue:[^ exceptionBlock value].
hour == 24 ifTrue:[
hour := 0.
]
]
]
].
- ^ self basicNew setHour:hour minutes:min seconds:sec
- ]
+ newTime := self basicNew setHour:hour minutes:min seconds:sec
+ ].
+ ^ newTime
"
Time readFrom:'0:00'
@@ -471,5 +471,5 @@
!Time class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.35 1998-08-02 20:39:09 tz Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.36 1999-02-22 20:39:37 cg Exp $'
! !