comment/format in: #addPrintBindingsTo:language:
authorMichael Beyl <mb@exept.de>
Wed, 11 May 2011 17:32:16 +0200
changeset 2566 ef461edd1746
parent 2565 a4e6a6d3141d
child 2567 b2820eb56b6a
comment/format in: #addPrintBindingsTo:language: changed: #formatForApproximatePrinting
TimeDuration.st
--- a/TimeDuration.st	Wed May 11 17:23:37 2011 +0200
+++ b/TimeDuration.st	Wed May 11 17:32:16 2011 +0200
@@ -549,7 +549,7 @@
         %(dR)       days rounded (i.e. for 36 hours, we get 1.5 asFixed:1 )
         %(hR)       hours rounded (i.e. for 3h 30m, we get 3.5 asFixed:1 )
         %(mR)       minutes rounded (i.e. for 2m 30s, we get 2.5 asFixed:1 )
-        %(sR)       seconds rounded (i.e. for 2s 100ms, we get 2.1 asFixed:1 )
+        %(sR)       seconds rounded to 1 postDecimal (i.e. for 2s 100ms, we get 2.1 asFixed:1 )
     "
 
     |hoursInDay s yearsRounded monthsRounded daysRounded hoursRounded minutesRounded secondsRounded|
@@ -623,7 +623,7 @@
      individual seconds or even milliseconds.
      The way this hidding/rounding is done is pure magic heuristics."
 
-    |hours mins secs|
+    |hours mins secs ms|
 
     hours := self hours.
 
@@ -665,6 +665,11 @@
     ].
 
     "/ no secs
+    ms := self milliseconds.
+    ms > 500 ifTrue:[
+        ^ '%(sR)s'
+    ].
+
     ^ self formatForPrinting
 
     "
@@ -1015,11 +1020,11 @@
 !TimeDuration class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.57 2011-05-11 15:23:37 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.58 2011-05-11 15:32:16 mb Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.57 2011-05-11 15:23:37 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.58 2011-05-11 15:32:16 mb Exp $'
 ! !
 
 TimeDuration initialize!