Help - MilliSecs() error??

Blitz3D Forums/Blitz3D Programming/Help - MilliSecs() error??

dgroncki(Posted 2004) [#1]
I just made a minor change to my game and went to test it and, after my game completely stopped working I tracked it down to the fact the the Millisecs() function on my machine is now returning negative values such as -1989814108.

Anyone have any ideas? Help!!


dgroncki(Posted 2004) [#2]
If I run this, I get negative numbers being reported for Millisecs():
Graphics 640,480
SetBuffer BackBuffer()
	
ms% = MilliSecs()
DebugLog "Millisecs() = " + ms%

While Not KeyHit(1)
	Cls
	Flip
Wend
End	



dgroncki(Posted 2004) [#3]
Sorry, I rebooted my machine and now I am getting positive values again. Any ideas what would be happening, though, when this occurs?


morduun(Posted 2004) [#4]
Yes. The millisecs counter is technically an unsigned int, while blitz only supports signed ints. When you pass the 2bil millisec mark, it swaps back to -2bil.

Solution: never depend on millisecs() being a positive number.


Dreamora(Posted 2004) [#5]
just don't let the system run for 24 days and there are no probs *ggg*

to solve problems with time differences there is no problem anyway ( ok 2 special cases. 1 where you are around the 2 billion border and 1 where you are around 0 when coming from negative. but they both only happen once so normally aren't causing problems )