from direct.distributed.TimeManager import TimeManager
- class TimeManager(cr)
This DistributedObject lives on the AI and on the client side, and serves to synchronize the time between them so they both agree, to within a few hundred milliseconds at least, what time it is.
It uses a pull model where the client can request a synchronization check from time to time. It also employs a round-trip measurement to minimize the effect of latency.
- __init__(self, cr)
This method is called when the DistributedObject is permanently removed from the world and deleted from the cache.
This method is called when the DistributedObject is removed from active duty and stored in a cache.
- doUpdate(self, task)
- extraSkew = 0
This method is called when the DistributedObject is reintroduced to the world, either for the first time or from the cache.
- maxAttempts = 5
- maxUncertainty = 1.0
- minWait = 10.0
- notify = <direct.directnotify.Notifier.Notifier object>
- reportFrameRateInterval = 300.0
- serverTime(self, int8 context, int32 timestamp)
This message is sent from the AI to the client in response to a previous requestServerTime. It contains the time as observed by the AI.
The client should use this, in conjunction with the time measurement taken before calling requestServerTime (above), to determine the clock delta between the AI and the client machines.
- synchronize(self, string description)
Call this function from time to time to synchronize watches with the server. This initiates a round-trip transaction; when the transaction completes, the time will be synced.
The description is the string that will be written to the log file regarding the reason for this synchronization attempt.
The return value is true if the attempt is made, or false if it is too soon since the last attempt.
- updateFreq = 1800.0