mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
getServerTimeOfDay
This commit is contained in:
parent
ef8938ef56
commit
3de67a9843
@ -8,6 +8,7 @@ import ClientDistClass
|
|||||||
import CRCache
|
import CRCache
|
||||||
import ConnectionRepository
|
import ConnectionRepository
|
||||||
import PythonUtil
|
import PythonUtil
|
||||||
|
import time
|
||||||
|
|
||||||
class ClientRepository(ConnectionRepository.ConnectionRepository):
|
class ClientRepository(ConnectionRepository.ConnectionRepository):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("ClientRepository")
|
notify = DirectNotifyGlobal.directNotify.newCategory("ClientRepository")
|
||||||
@ -42,6 +43,19 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
def getServerDelta(self):
|
def getServerDelta(self):
|
||||||
return self.serverDelta
|
return self.serverDelta
|
||||||
|
|
||||||
|
def getServerTimeOfDay(self):
|
||||||
|
"""
|
||||||
|
Returns the current time of day (seconds elapsed since the
|
||||||
|
1972 epoch) according to the server's clock. This is in GMT,
|
||||||
|
and hence is irrespective of timezones.
|
||||||
|
|
||||||
|
The value is computed based on the client's clock and the
|
||||||
|
known delta from the server's clock, which is not terribly
|
||||||
|
precisely measured and may drift slightly after startup, but
|
||||||
|
it should be accurate plus or minus a couple of seconds.
|
||||||
|
"""
|
||||||
|
return time.time() + self.cr.getServerDelta()
|
||||||
|
|
||||||
def parseDcFile(self, dcFileName):
|
def parseDcFile(self, dcFileName):
|
||||||
self.dcFile = DCFile()
|
self.dcFile = DCFile()
|
||||||
readResult = self.dcFile.read(dcFileName)
|
readResult = self.dcFile.read(dcFileName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user