Solved: Problems with time functions


21-08-2006 02:53:41

I'm having some issues with running PyOgre and using Python's time and datetime modules. After calling root.initialise(True), time functions in Python act as if time has stopped. For instance, the value of time.time() never increases. I'm running on Windows XP and have not tested this in Linux just yet. I am using pyogre-1.0.6 and Python 2.4.3.

An easy way to show this behavior is to just run the following code every frame:

import time
print time.time()

Sometimes, I've noticed it'll change every few minutes, but for the most part, it stays the same. This is causing some major issues with other modules I'm using (Twisted for example).

Anyone have any ideas? Perhaps it's my setup or something else I'm doing wrong-- I'm very new to Ogre. If I call root.initialise(False), time works, but then I don't have anything to render to. :)

Any help or ideas would be appreciated.




21-08-2006 22:48:04

No solution, but I just tested it with pyogre-1.2 and got the same behavior.


22-08-2006 03:49:49

Good to know it wasn't my set up. Thanks for letting me know. I'm still working on compiling PyOgre 1.2 on Linux, but I doubt there will be a problem there. I see other people here using PyOgre and Twisted, so it must work somewhere. I'll post when I have it working on Linux.




23-08-2006 02:51:56

It works fine on Linux. If anyone has any clues as to why this may be happening, I'm definitely interested in hearing them. Otherwise, I'll probably go about digging through PyOgre and Ogre to trace the initialise function and see what it's doing to Windows time functions.




04-09-2006 23:42:58

I stopped doing development on Windows in favor of Linux for a while because of this bug. I just went back to try a few more ways to fix this problem on Windows and I found the solution.

I certainly should have tried this before, but using the OpenGL renderer instead of DirectX makes everything work fine.




05-09-2006 09:24:28

I noticed that in very simple unit tests too... sometimes I get "Tests ran in <negative number> seconds."

Using the clock() function instead is very robust.



26-02-2010 07:56:50

I encounter the same issue in similar circumstances in my project, but not using PyOgre.
I'm using standard C++ Ogre SDK but I'm calling Python code from my C++ project through embedding.

I'm facing exactly the same problem: after calling root.initialise(), the value of time.time() never or rarely increases ; also if I try:

import time
test = time.time()
target = test + 30.0

then "target" wasn't increased by 30.0 and still has the same value as "test"!

This is very annoying because I'm embedding some complex python code and it's not trivial to modify it in order to use "time.clock()" instead of "time.time()"
I confirm that it's working fine with OpenGL but I don't want to tie my customers to OpenGL, they shoulp be able to opt for Direct3D if they wish.

The question is: is that problem caused by Ogre or by Direct3D?



26-02-2010 10:37:35

I think the following links may help, or search on the main forum for D3DCREATE_FPU_PRESERVE /google for python/D3DCREATE_FPU_PRESERVE.

viewtopic.php?f=3&t=3404&p=19608&hilit=Floating+point+mode#p19608 ... VE#p373940


26-02-2010 13:32:07

Many thanks!

In the meantime I found on that thread that I could change "floating-point mode" to "consistent", but it wasn't really explaining why.