.
authorclaus
Sun, 27 Aug 1995 02:30:27 +0200
changeset 409 a00dfa34388b
parent 408 4138a907dc17
child 410 d5a8f2b26071
.
Time.st
--- a/Time.st	Sun Aug 27 02:29:02 1995 +0200
+++ b/Time.st	Sun Aug 27 02:30:27 1995 +0200
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Time.st,v 1.19 1995-08-15 23:46:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Time.st,v 1.20 1995-08-27 00:30:27 claus Exp $
 '!
 
 !Time class methodsFor:'documentation'!
@@ -44,16 +44,16 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Time.st,v 1.19 1995-08-15 23:46:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Time.st,v 1.20 1995-08-27 00:30:27 claus Exp $
 "
 !
 
 documentation
 "
     Instances of time represent a particular time-of-day.
-    Since they only store hours, minutes and seconds of a day,
-    they cannot be used to compare times across midnight (i.e. should
-    not be used as timeStamps).
+    Since they only store hours, minutes and seconds within a day,
+    they cannot be used to compare times across midnight 
+    (i.e. they should not be used as timeStamps).
     Use instances of AbsoluteTime (and read the comment there) to do this.
 
     Examples:
@@ -90,9 +90,7 @@
 readFrom:aStream onError:exceptionBlock
     "return a new Time, reading a printed representation from aStream.
      If no pm follows the time, the string is interpreted as either 24 hour format
-     or being am.
-     Notice, that this is not the storeString format and 
-     is different from the format expected by readFrom:."
+     or being am."
 
     |hour min sec ex|
 
@@ -116,12 +114,12 @@
     ^ self basicNew setHour:hour minutes:min seconds:sec
 
     "
-     Time readFromString:'18:22:00'    
-     Time readFromString:'14:00:11'    
-     Time readFromString:'7:00:11'     
-     Time readFromString:'6:22:00 pm'   
-     Time readFromString:'2:00:11 pm'  
-     Time readFromString:'7:00:11 am'  
+     Time readFrom:'18:22:00'    
+     Time readFrom:'14:00:11'    
+     Time readFrom:'7:00:11'     
+     Time readFrom:'6:22:00 pm'   
+     Time readFrom:'2:00:11 pm'  
+     Time readFrom:'7:00:11 am'  
     "
 ! !
 
@@ -196,11 +194,13 @@
 
 print24HourFormatOn:aStream
     "append a printed representation of the receiver to aStream.
-     Format is hh:mm:ss in 24-hour format."
+     Format is hh:mm:ss (i.e. 24-hour european format)."
+
+    |h m s|
 
-    |m s|
-
-    self hours printOn:aStream.
+    h := self hours.
+    (h < 10) ifTrue:[aStream nextPut:$0].
+    h printOn:aStream.
     aStream nextPut:$:.
     m := self minutes.
     (m < 10) ifTrue:[aStream nextPut:$0].
@@ -219,7 +219,7 @@
     "append a printed representation of the receiver to aStream.
      Format is hh:mm:ss am/pm (i.e. 12-hour american format)."
 
-    |h m s|
+    |h m s ampm|
 
     h := self hours.
     h > 12 ifTrue:[
@@ -237,12 +237,13 @@
     aStream nextPut:$:.
     s := self seconds.
     (s < 10) ifTrue:[aStream nextPut:$0].
-	s printOn:aStream.
+    s printOn:aStream.
     h >= 12 ifTrue:[
-	aStream nextPutAll:' am'
+	ampm := ' am'
     ] ifFalse:[
-	aStream nextPutAll:' pm'
-    ]
+	ampm := ' pm'
+    ].
+    aStream nextPutAll:ampm
 
     "
      Time now print12HourFormatOn:Transcript. Transcript cr
@@ -357,4 +358,3 @@
 
     ^ timeEncoding
 ! !
-