equal
deleted
inserted
replaced
1 "{ Encoding: utf8 }" |
|
2 |
|
3 " |
1 " |
4 COPYRIGHT (c) 1989 by Claus Gittinger |
2 COPYRIGHT (c) 1989 by Claus Gittinger |
5 All Rights Reserved |
3 All Rights Reserved |
6 |
4 |
7 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
603 (TimeDuration fromString:'-10s') * 1000 |
601 (TimeDuration fromString:'-10s') * 1000 |
604 (TimeDuration fromString:'10s') * (TimeDuration fromString:'10s') |
602 (TimeDuration fromString:'10s') * (TimeDuration fromString:'10s') |
605 " |
603 " |
606 ! |
604 ! |
607 |
605 |
|
606 + aTimeDurationOrNumberOfSeconds |
|
607 "return a new timeDuration" |
|
608 |
|
609 aTimeDurationOrNumberOfSeconds isNumber ifTrue:[ |
|
610 ^ self species basicNew |
|
611 setMilliseconds:(self getMilliseconds + (aTimeDurationOrNumberOfSeconds * 1000) asInteger) |
|
612 ]. |
|
613 ^ self species basicNew |
|
614 setMilliseconds:(self getMilliseconds + aTimeDurationOrNumberOfSeconds getMilliseconds) |
|
615 |
|
616 " |
|
617 (TimeDuration fromString:'1m') + (TimeDuration fromString:'10s') |
|
618 1 minutes + 10 seconds |
|
619 " |
|
620 ! |
|
621 |
608 / aTimeDurationOrNumberOfSeconds |
622 / aTimeDurationOrNumberOfSeconds |
609 "if the argument is a number, return a new timeDuration. |
623 "if the argument is a number, return a new timeDuration. |
610 Otherwise, return the quotient as a number." |
624 Otherwise, return the quotient as a number." |
611 |
625 |
612 aTimeDurationOrNumberOfSeconds isNumber ifTrue:[ |
626 aTimeDurationOrNumberOfSeconds isNumber ifTrue:[ |
776 "return a TimeDuration object from the receiver - that's the receiver." |
790 "return a TimeDuration object from the receiver - that's the receiver." |
777 |
791 |
778 ^ self |
792 ^ self |
779 ! ! |
793 ! ! |
780 |
794 |
781 |
795 !TimeDuration methodsFor:'double dispatching'! |
|
796 |
|
797 differenceFromTimestamp:aTimestamp |
|
798 "return the timestamp this timeDuration before aTimestamp" |
|
799 |
|
800 ^ aTimestamp subtractMilliseconds:(self getMilliseconds) |
|
801 ! |
|
802 |
|
803 productFromNumber:aNumber |
|
804 "sent when an integer does not know how to multiply the receiver. |
|
805 Return a new timeDuration" |
|
806 |
|
807 ^ self species basicNew |
|
808 setMilliseconds:(self getMilliseconds * aNumber) asInteger |
|
809 |
|
810 " |
|
811 5.1 * (TimeDuration fromString:'10s') |
|
812 " |
|
813 |
|
814 "Modified (comment): / 12-06-2017 / 20:50:51 / cg" |
|
815 ! |
|
816 |
|
817 sumFromTimestamp:aTimestamp |
|
818 "return the timestamp this timeDuration after aTimestamp" |
|
819 |
|
820 ^ aTimestamp addMilliseconds:(self getMilliseconds) |
|
821 ! ! |
782 |
822 |
783 !TimeDuration methodsFor:'printing'! |
823 !TimeDuration methodsFor:'printing'! |
784 |
824 |
785 addPrintBindingsTo:aDictionary language:languageOrNil |
825 addPrintBindingsTo:aDictionary language:languageOrNil |
786 "private print support: add bindings for printing to aDictionary. |
826 "private print support: add bindings for printing to aDictionary. |