# HG changeset patch # User Claus Gittinger # Date 1191505516 -7200 # Node ID fc107aed9bb9421c9ee08d61621b3dbf4ae65632 # Parent f2ca9e7fdb3cb09eae066c2e55a8fa1aa913176e arithmetic on time-durations diff -r f2ca9e7fdb3c -r fc107aed9bb9 TimeDuration.st --- a/TimeDuration.st Tue Sep 25 11:21:45 2007 +0200 +++ b/TimeDuration.st Thu Oct 04 15:45:16 2007 +0200 @@ -239,6 +239,34 @@ ^ timeEncoding \\ 1000 ! ! +!TimeDuration methodsFor:'arithmetic'! + ++ aTimeDurationOrNumberOfSeconds + "return a new timeDuration" + + aTimeDurationOrNumberOfSeconds isNumber ifTrue:[ + ^ self species basicNew + setMilliseconds:(self getMilliseconds + (aTimeDurationOrNumberOfSeconds * 1000) asInteger) + ]. + ^ self species basicNew + setMilliseconds:(self getMilliseconds + aTimeDurationOrNumberOfSeconds getMilliseconds) + + "Created: / 04-10-2007 / 14:12:40 / cg" +! + +- aTimeDurationOrNumberOfSeconds + "return a new timeDuration" + + aTimeDurationOrNumberOfSeconds isNumber ifTrue:[ + ^ self species basicNew + setMilliseconds:(self getMilliseconds - (aTimeDurationOrNumberOfSeconds * 1000) asInteger) + ]. + ^ self species basicNew + setMilliseconds:(self getMilliseconds - aTimeDurationOrNumberOfSeconds getMilliseconds) + + "Created: / 04-10-2007 / 14:12:29 / cg" +! ! + !TimeDuration methodsFor:'converting'! asTime @@ -415,5 +443,5 @@ !TimeDuration class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.21 2007-09-06 15:31:09 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic2/Attic/TimeDuration.st,v 1.22 2007-10-04 13:45:16 cg Exp $' ! !