bug : millisecs() returns a negative decreasing value on Windows 10 (fixed)

Started by RemiD, March 27, 2018, 09:38:21

Previous topic - Next topic

RemiD

ok, what TomToad suggested ( using (MilliSecs() And $7FFFFFFF) instead of Millisecs() ) apparently works, it returns a positive value which increases. Good ! thanks.

The other workaround that i have found was to set the initial MilliValue for each entity to -2147483647+I (I being the index number of the entity)

Thanks TomToad ! :)

GrindalfGames

I was also having this problem in my game on win10 but for me it doesn't always happen(seems to only happen if my computer has been in sleep mode) Turning the computer off and back on solves it. I have rewritten my code now so I no longer have the issue

RemiD

i have encountered a similar problem with another computer with Windows 10.



going to try this :

Graphics3D(640,360,32,2)

Global NormalMil% = MilliSecs()
Global FixMil% = MilliSecs() And $7FFFFFFF

Global MainLoopTimer = CreateTimer(30)

Main()

End()

Function Main()

Repeat

  If( KeyHit(28)=1 )
   NormalMil = MilliSecs()
   FixMil = MilliSecs() And $7FFFFFFF
  EndIf

  SetBuffer(BackBuffer())
  ClsColor(000,000,000) : Cls()

  Color(250,250,250)
  TStr$ = NormalMil : Text(GraphicsWidth()/2-StringWidth(TStr)/2,0,TStr)
  TStr$ = FixMil : Text(GraphicsWidth()/2-StringWidth(TStr)/2,15,TStr)

  ;Flip(1)
  WaitTimer(MainLoopTimer)
  VWait():Flip(False)

Until( KeyDown(1)=1 )

End Function


then i will report...

edit : yes it was the cause of the  problem and the fix seems to work well.

the weird thing is that the computer with Windows 10 has just been started...

thanks TomToad !

Derron

Some computers do "quick starts" (like returning from "Hibernation") .. this does not reset the uptime (which leads to the overflow issue).


bye
Ron

Midimaster

I think this is wrong
MilliSecs() AND $7FFFFFFF

shouldn't it be:
MilliSecs() & $7FFFFFFF

If you overload the function you need not to write every time the appendix:
Or give it a new name:
Code (BlitzMax) Select
Print MilliSecs(1)

Print MilliSecsNew()

Function MilliSecs:Int (x%)
Return MilliSecs() & $7FFFFFFF
End Function

Function MilliSecsNew()
Return MilliSecs() & $7FFFFFFF
End Function
...back from Egypt

RemiD

this computer was off and unplugged from any AC electricity source for at least 1month...

RemiD

@Midimaster>>
i use the AND operator quite often in Blitz3d...


good idea for the function, thanks