bug time?

seem that the time is saved only one time , then remain unchanged!
this is the simple code , to run with always pulse

import bge
import time

def m(cont):
    own = cont.owner
    newTime = time.time()
    if not "init" in own:
        own["init"] = 1
        own["oldTime"] = newTime
    diff = newTime - own["oldTime"] 
    print("OLD-> ", own["oldTime"])
    print("NEW-> ", newTime )

    own["oldTime"] = newTime #---------->> this line basically do nothing!

this image below is the debug :
how you can see the old time is ever the same , while the new change.
what’s ?:eek:


I don’t konw why time() is not working.
Use time.clock()

Obvious from here is that no new time is being generated, is time.time() part of the bge module

shoot! didn’t see import time. the problem is time.time() though.

well , time.clock() work well,and seem also much more accurate.

anyway is strange the things of time.time

seem a problem only with the property float of the object.

if i use a local variable it work as expected

import bge
import time

def m(cont):
    own = cont.owner
    t1 = time.time()
    for i in range(200000):
    t2 = time.time()
    print("t1", t1)
    print("t2", t2)

or also by storing the value in a class (between different step)
mah…mistery :wink: