[ENH] Time-since
Michael Rueger
Michael.Rueger.-ND at disney.com
Wed Mar 1 23:04:20 UTC 2000
Change Set: Time-since-mir
Date: 1 March 2000
Author: Michael Rueger
Utility methods to find the delta time without the need to check for a
rollover every time.
--
"To improve is to change, to be perfect is to change often."
Winston Churchill
+------------------------------------------------------------+
| Michael Rueger |
| Phone: ++1 (818) 623 3283 Fax: ++1 (818) 623 3559 |
+---------- Michael.Rueger.-ND at corp.go.com ------------------+
-------------- next part --------------
"Change Set: Time-since-mir
Date: 1 March 2000
Author: Michael Rueger
Utility methods to find the delta time without the need to check for a rollover every time.
"!
!Time class methodsFor: 'general inquiries' stamp: 'mir 10/29/1999 18:27'!
milliseconds: currentTime since: lastTime
| delta |
"Answer the elapsed time since last recorded in milliseconds.
Compensate for rollover."
delta _ currentTime - lastTime.
^delta < 0
ifTrue: [SmallInteger maxVal + delta]
ifFalse: [delta]
! !
!Time class methodsFor: 'general inquiries' stamp: 'mir 10/29/1999 18:24'!
millisecondsSince: lastTime
"Answer the elapsed time since last recorded in milliseconds.
Compensate for rollover."
^self milliseconds: self millisecondClockValue since: lastTime! !
More information about the Squeak-dev
mailing list
|