from datetime import datetimefrom time import time from bge import logic c = logic.getCurrentController() o = c.owner o['micro'] = datetime.now().microsecond o['second'] = time() print(time())
With the above script, running on a pulsing always sensor, ‘micro’ constantly changes while ‘second’ sticks to a single value. Strangely, printing time() by itself shows that the system has no problem updating its clock. In the editor, ‘second’ is set as a float, so that’s not the issue. What am I doing wrong, here?
For clarification, I’m trying to keep track of the timestamp to log player input in a somewhat framerate-independent manner. The idea is to send inputs across a network, with a timestamp attached, for the sake of synchronization; and indexing snapshots of each frame.