Timing issues (win7 i think)

I was using time.clock() originally(for the precision), then i discovered it does not work on one specific win7 machine, so i changed it to time.time() nothing changed so i posted on the forums.

The above code example does not work with time.clock() either on specific win7 machines.

Cheers

Ok made a new example:
It uses:
time.time()
time.clock()
clockObject.getRealTime()
clockObject.getLongTime()
task.time

They are not synced.

The question is what works and what does not.
All display time flow and fade in a 1 sec interval.

p3d:
moba.ee/test.html

# -*- coding: utf-8 -*-
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import PandaNode,TextNode,NodePath
import sys,time

class Showoff(DirectObject):
    def __init__(self):                
        base.buttonThrowers[0].node().setButtonDownEvent('bdown')
        base.buttonThrowers[0].node().setButtonUpEvent('bup')            
        self.accept('bdown', self.buttons,[True])
        self.accept('bup', self.buttons,[False])         
        
        self.calls=[
                    time.time,
                    time.clock,
                    globalClock.getRealTime,
                    globalClock.getLongTime,
                    False                    
                    ]
        self.names=[
                'time.time()',
                'time.clock()',
                'clockObject.getRealTime()',
                'clockObject.getLongTime()',
                'task.time()'
               ]
                    
        self.objs=[]
        for nr in range(5):
            
            ob=Obj(self.names[nr],self.calls[nr])
            ob.textnode.setZ(0.8-0.2*nr)  
            self.objs.append(ob)          
        
    def buttons(self,tag,but):
        if tag:
            if but=='escape':
                sys.exit()
                        
    def run(self,task):
        for nr in range(5):
            obj=self.objs[nr] 
            if nr!=4:                
                tt=obj.call()                
            else:
                tt=task.time
            lt=tt
            dif=tt-obj.last
            if dif>1:
                obj.last=lt
            obj.textnode.setColor(1,1,1,dif)
            obj.text.setText(obj.name+str(tt))                
        
        return task.cont
        
class Obj():
    def __init__(self,name,call):
        self.name=name
        self.call=call
        self.starttime=0
        self.last=False
        
        self.text=TextNode('textnode')        
        if name:
            self.text.setText(name)
        self.textnode=aspect2d.attachNewNode(self.text)
        self.textnode.setScale(0.05)   
        #self.text.setAlign(TextNode.ARight)     
        
so=Showoff()
taskMgr.add(so.run,'myrun')
oo=Obj('press esc to exit',False)
oo.textnode.setZ(-0.3)
run()

all 4 are working fine on win 7 chrome browser :slight_smile:

Hmm very intresting, as the time.time(0 one was not working for you before. And there were 5, but i quess
clockObject.getRealTime() and clockObject.getLongTime()
are exactly the same.

Ill have to wait til tommorrow til i can test it on the problemativ win7 machine

oh right, there should’ve been 5 timers. the time.time wasn’t visible at all.

When i ran With win7 64bit I saw everything but time.time and the top 2 i saw seemed accurate (they were perfectly synced) the bottom one for me was very close though but the 3 from the top (remember time.time is missing) did not seem even close