from direct.distributed.TimeManager import TimeManager

Inheritance diagram

Inheritance diagram of direct.distributed.TimeManager

class TimeManager(cr)[source]

Bases: direct.distributed.DistributedObject.DistributedObject

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)[source]

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)[source]
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)[source]

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)[source]

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