[BUG][FIX] accurateDateAndTimeNow-brp ( [er] needs to be reviewed again )

brent.pinkney at aircom.co.za brent.pinkney at aircom.co.za
Mon Oct 4 21:17:38 CEST 2004


Needs to be reviewed with Ned's proposal:

If you assume that:
- the millisecond clock rate is accurate (which it had better be!)
- the millisecond clock is an unsigned number, limited to SmallInteger 
maxVal / 2 (which it is; it's masked with 16r1FFFFFFF)
 
then you can do this:
 
globals:
 
BigMillisecondClock is an arbitrary-precision integer
 
LastMillisecondClock is a SmallInteger, a copy of the millisecondClock
the 
last time we looked at it
 
MaxMillisecondClockValue is the maximum value of the millisecond clock
on this 
platform
 
from time to time (that is, more often than MaxMillisecondClockValue):
 
now := Time millisecondClockValue.
delta := now - LastMillisecondClock.
delta < 0 ifTrue: [ "wrapped"
 delta := delta + MaxMillisecondClockValue + 1 ].
BigMillisecondClock := BigMillisecondClock + delta.
LastMillisecondClock := now.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: accurateDateAndTimeNow-brp.1.cs.gz
Type: application/octet-stream
Size: 1 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-harvest/attachments/20041004/8633f461/accurateDateAndTimeNow-brp.1.cs.obj


More information about the Squeak-harvest mailing list