direct.distributed.ClockDelta

from direct.distributed.ClockDelta import ClockDelta

Inheritance diagram

Inheritance diagram of direct.distributed.ClockDelta

class ClockDelta[source]

Bases: direct.showbase.DirectObject.DirectObject

The ClockDelta object converts between universal (“network”) time, which is used for all network traffic, and local time (e.g. as returned by getFrameTime() or getRealTime()), which is used for everything else.

__init__(self)[source]
clear(self)[source]

Throws away any previous synchronization information.

getDelta(self)[source]
getFrameNetworkTime(self, bits=16, ticksPerSec=100.0)[source]

Returns the current getFrameTime() expressed as a network time.

getLastResync(self)[source]
getRealNetworkTime(self, bits=16, ticksPerSec=100.0)[source]

Returns the current getRealTime() expressed as a network time.

getUncertainty(self)[source]
localElapsedTime(self, int networkTime)[source]

Returns the amount of time elapsed (in seconds) on the client since the server message was sent. Negative values are clamped to zero.

localToNetworkTime(self, float localTime)[source]

Converts the indicated localTime to the corresponding networkTime value.

networkToLocalTime(self, int networkTime)[source]

Converts the indicated networkTime to the corresponding localTime value. The time is assumed to be within +/- 5 minutes of the current local time given in now, or getRealTime() if now is not specified.

newDelta(self, localTime, newDelta, newUncertainty, trustNew=1)[source]

Accepts a new delta and uncertainty pair, understood to represent time as of localTime. Improves our current notion of the time delta accordingly. The return value is true if the new measurement was used, false if it was discarded.

notify = <direct.directnotify.Notifier.Notifier object>
peerToPeerResync(self, avId, timestamp, serverTime, uncertainty)[source]

Accepts an AI time and uncertainty value from another client, along with a local timestamp value of the message from this client which prompted the other client to send us its delta information.

The return value is true if the other client’s measurement was reasonably close to our own, or false if the other client’s time estimate was wildly divergent from our own; the return value is negative if the test was not even considered (because it happened too soon after another recent request).

resynchronize(self, localTime, networkTime, newUncertainty, trustNew=1)[source]
resynchronize(self, float localTime, int32 networkTime,

float newUncertainty)

Accepts a new networkTime value, which is understood to represent the same moment as localTime, plus or minus uncertainty seconds. Improves our current notion of the time delta accordingly.