586 ! |
587 ! |
587 |
588 |
588 - aTimeOrNumberOfSeconds |
589 - aTimeOrNumberOfSeconds |
589 "return the delta in seconds between 2 times or subtract a number of seconds." |
590 "return the delta in seconds between 2 times or subtract a number of seconds." |
590 |
591 |
591 "/ aTimeOrNumberOfSeconds isNumber ifTrue:[ |
|
592 "/ ^ self species basicNew |
|
593 "/ setMilliseconds:(self getMilliseconds - (aTimeOrNumberOfSeconds * 1000) asInteger) |
|
594 "/ ]. |
|
595 "/ ^ self getSeconds - aTimeOrNumberOfSeconds getSeconds |
|
596 ^ aTimeOrNumberOfSeconds differenceFromTimestamp:self. |
592 ^ aTimeOrNumberOfSeconds differenceFromTimestamp:self. |
597 |
593 |
598 " |
594 " |
599 Timestamp now - 3600. |
595 Timestamp now - 3600. |
600 Time now - 3600. |
596 Time now - 3600. |
898 |
894 |
899 differenceFromTimestamp:aTimestamp |
895 differenceFromTimestamp:aTimestamp |
900 "/ the correct thing to do (and I will, in the future) is to |
896 "/ the correct thing to do (and I will, in the future) is to |
901 "/ return a TimeDuration: |
897 "/ return a TimeDuration: |
902 "/ |
898 "/ |
903 ^ TimeDuration fromMilliseconds:(self getMilliseconds - (aTimestamp getMilliseconds)) |
899 ^ TimeDuration fromMilliseconds:(aTimestamp getMilliseconds -self getMilliseconds). |
|
900 |
904 "/ which is the same as: deltaFrom:aTimestamp |
901 "/ which is the same as: deltaFrom:aTimestamp |
905 "/ |
902 "/ |
906 "/ however, there might be old code around, which is not be prepared for |
903 "/ however, there might be old code around, which is not be prepared for |
907 "/ getting a non-number (the seconds). Therefore, for the meantime, |
904 "/ getting a non-number (the seconds). Therefore, for the meantime, |
908 "/ we return: |
905 "/ we return: |
909 |
906 |
910 "/ ^ aTimestamp getSeconds - self getSeconds |
907 "/ ^ aTimestamp getSeconds - self getSeconds |
911 ! ! |
908 ! ! |
|
909 |
912 |
910 |
913 !AbstractTime methodsFor:'printing & storing'! |
911 !AbstractTime methodsFor:'printing & storing'! |
914 |
912 |
915 addPrintBindingsTo:aDictionary |
913 addPrintBindingsTo:aDictionary |
916 "private print support: add bindings for printing to aDictionary." |
914 "private print support: add bindings for printing to aDictionary." |