# HG changeset patch # User Claus Gittinger # Date 1193407645 -7200 # Node ID ec30ff95406a1049f061efec9e1a95aca580a0f0 # Parent 12a5da5c091d3f4c0bedfa8a7a0101da1a85f536 default printFormat diff -r 12a5da5c091d -r ec30ff95406a TimeDuration.st --- 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!