Time.st
changeset 6467 f200ac48f2a8
parent 6165 0ac589c3d92a
child 6624 886265eff14c
--- a/Time.st	Fri Mar 15 23:21:37 2002 +0100
+++ b/Time.st	Mon Mar 18 12:01:03 2002 +0100
@@ -89,12 +89,10 @@
      Time fromSeconds:36000     
      Time fromSeconds:72000     
      Time fromSeconds:96000      
+     Time fromSeconds:360000      
     "
 
     "Modified: 8.10.1996 / 19:32:11 / cg"
-
-
-
 !
 
 hour:h minutes:m seconds:s
@@ -248,21 +246,56 @@
     "Treat the time as a difference.  
      Give it in hours and minutes with two digits of accuracy."
 
-    |hours minutes seconds hh mm ss |
+    |hours minutes seconds hh mm ss s|
 
     hours := self hours.
     minutes := self minutes.
     seconds := self seconds.
-    hh := hours = 0   ifTrue: [''] ifFalse: [' ', hours printString, ' hours'].
-    mm := minutes = 0 ifTrue: [''] ifFalse: [' ', minutes printString, ' minutes'].
-    ss := seconds = 0 ifTrue: [''] ifFalse: [' ', seconds printString, ' seconds'].
+
+    hours = 0   
+        ifTrue: [hh := ''] 
+        ifFalse: [
+            hh := hours printString, ' hour'.
+            hours > 1 ifTrue:[
+                hh := hh , 's'
+            ]
+        ].
+    minutes = 0 
+        ifTrue: [mm := ''] 
+        ifFalse: [
+            mm := minutes printString, ' minute'.
+            minutes > 1 ifTrue:[
+                mm := mm , 's'
+            ]
+        ].
+    seconds = 0 
+        ifTrue: [ss := ''] 
+        ifFalse: [
+            ss := seconds printString, ' second'.
+            seconds > 1 ifTrue:[
+                ss := ss , 's'
+            ]
+        ].
+
+    "/ do not show seconds, if hours are there
     hh size > 0 ifTrue: [ss := ''].
-    ^ hh, mm, ss
+
+    s := hh.
+    hh notEmpty ifTrue:[
+        hh := hh , ' '
+    ].
+    s := s , mm.
+    mm notEmpty ifTrue:[
+        mm := mm , ' '
+    ].
+    ^ s , ss
 
     "
-     (Time fromSeconds:3600) intervalString
-     (Time fromSeconds:3605) intervalString
-     (Time fromSeconds:5) intervalString  
+     (Time fromSeconds:360000) intervalString      
+     (Time fromSeconds:3600) intervalString    
+     (Time fromSeconds:3605) intervalString  
+     (Time fromSeconds:3700) intervalString  
+     (Time fromSeconds:5) intervalString    
      (Time fromSeconds:65) intervalString   
     "
 !
@@ -628,5 +661,5 @@
 !Time class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.52 2001-11-08 16:07:36 md Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.53 2002-03-18 11:01:03 cg Exp $'
 ! !