--- a/TimeDuration.st Fri Oct 26 16:04:00 2007 +0200
+++ b/TimeDuration.st Fri Oct 26 16:07:25 2007 +0200
@@ -366,6 +366,13 @@
formatForPrinting
"Return a format which is suitable for a human - not meant to be read back."
+ ^ self formatForPrinting:false
+!
+
+formatForPrinting:shortFlag
+ "Return a format which is suitable for a human - not meant to be read back.
+ If shortFlag is true, some millisecond-info is ommitted for longer times."
+
|fmt hours mins secs overAllSeconds millis|
hours := self hours.
@@ -414,16 +421,20 @@
secs = 0 ifTrue:[
fmt := fmt , '%Ims'
] ifFalse:[
- overAllSeconds := self asSeconds.
- overAllSeconds > 2 ifTrue:[
- overAllSeconds > 10 ifTrue:[
- overAllSeconds > 300 ifTrue:[
- fmt := fmt , '%Ss'
+ shortFlag ifTrue:[
+ overAllSeconds := self asSeconds.
+ overAllSeconds > 2 ifTrue:[
+ overAllSeconds > 10 ifTrue:[
+ overAllSeconds > 300 ifTrue:[
+ fmt := fmt , '%Ss'
+ ] ifFalse:[
+ fmt := fmt , '%S.%(milli1)s'
+ ]
] ifFalse:[
- fmt := fmt , '%S.%(milli1)s'
+ fmt := fmt , '%S.%(milli2)s'
]
] ifFalse:[
- fmt := fmt , '%S.%(milli2)s'
+ fmt := fmt , '%S.%is'
]
] ifFalse:[
fmt := fmt , '%S.%is'
@@ -562,7 +573,7 @@
!TimeDuration class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.27 2007-10-26 14:04:00 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.28 2007-10-26 14:07:25 cg Exp $'
! !
TimeDuration initialize!