Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ClockDelta Class Reference
Inheritance diagram for ClockDelta:

Public Member Functions

 __init__ (self)
 
 clear (self)
 
 getDelta (self)
 
 getFrameNetworkTime (self, bits=16, ticksPerSec=NetworkTimePrecision)
 
 getLastResync (self)
 
 getRealNetworkTime (self, bits=16, ticksPerSec=NetworkTimePrecision)
 Convenience functions ###.
 
 getUncertainty (self)
 
 localElapsedTime (self, networkTime, bits=16, ticksPerSec=NetworkTimePrecision)
 
 localToNetworkTime (self, localTime, bits=16, ticksPerSec=NetworkTimePrecision)
 
 networkToLocalTime (self, networkTime, now=None, bits=16, ticksPerSec=NetworkTimePrecision)
 Primary interface functions ###.
 
 newDelta (self, localTime, newDelta, newUncertainty, trustNew=1)
 
 peerToPeerResync (self, avId, timestamp, serverTime, uncertainty)
 
 resynchronize (self, localTime, networkTime, newUncertainty, trustNew=1)
 

Public Attributes

 delta
 
 globalClock
 
 lastResync
 
 uncertainty
 

Static Public Attributes

 notify = DirectNotifyGlobal.directNotify.newCategory('ClockDelta')
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self)

Member Function Documentation

◆ clear()

clear ( self)
Throws away any previous synchronization information.

◆ getDelta()

getDelta ( self)

◆ getFrameNetworkTime()

getFrameNetworkTime ( self,
bits = 16,
ticksPerSec = NetworkTimePrecision )
Returns the current getFrameTime() expressed as a network time.

◆ getLastResync()

getLastResync ( self)

◆ getRealNetworkTime()

getRealNetworkTime ( self,
bits = 16,
ticksPerSec = NetworkTimePrecision )

Convenience functions ###.

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

◆ getUncertainty()

getUncertainty ( self)

◆ localElapsedTime()

localElapsedTime ( self,
networkTime,
bits = 16,
ticksPerSec = NetworkTimePrecision )
localElapsedTime(self, int networkTime)

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

◆ localToNetworkTime()

localToNetworkTime ( self,
localTime,
bits = 16,
ticksPerSec = NetworkTimePrecision )
localToNetworkTime(self, float localTime)

Converts the indicated localTime to the corresponding
networkTime value.

◆ networkToLocalTime()

networkToLocalTime ( self,
networkTime,
now = None,
bits = 16,
ticksPerSec = NetworkTimePrecision )

Primary interface functions ###.

networkToLocalTime(self, int networkTime)

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()

newDelta ( self,
localTime,
newDelta,
newUncertainty,
trustNew = 1 )
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.

◆ peerToPeerResync()

peerToPeerResync ( self,
avId,
timestamp,
serverTime,
uncertainty )
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()

resynchronize ( self,
localTime,
networkTime,
newUncertainty,
trustNew = 1 )
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.

Member Data Documentation

◆ delta

delta

◆ globalClock

globalClock

◆ lastResync

lastResync

◆ notify

notify = DirectNotifyGlobal.directNotify.newCategory('ClockDelta')
static

◆ uncertainty

uncertainty