September 24, 2021, 09:09:47

Author Topic: bug : millisecs() returns a negative decreasing value on Windows 10 (fixed)  (Read 3752 times)

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1282
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 ! :)
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline grindalf

  • Full Member
  • ***
  • Posts: 191
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

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1282
i have encountered a similar problem with another computer with Windows 10.



going to try this :
Code: [Select]
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 !
« Last Edit: April 19, 2021, 10:50:45 by RemiD »
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Derron

  • Hero Member
  • *****
  • Posts: 3651
Some computers do "quick starts" (like returning from "Hibernation") .. this does not reset the uptime (which leads to the overflow issue).


bye
Ron

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
I think this is wrong
Code: [Select]
MilliSecs() AND $7FFFFFFF
shouldn't it be:
Code: [Select]
MilliSecs() & $7FFFFFFF
If you overload the function you need not to write every time the appendix:
Or give it a new name:
Code: BlitzMax
  1. Print MilliSecs(1)
  2.  
  3. Print MilliSecsNew()
  4.  
  5. Function MilliSecs:Int (x%)
  6.         Return MilliSecs() & $7FFFFFFF
  7. End Function
  8.  
  9. Function MilliSecsNew()
  10.         Return MilliSecs() & $7FFFFFFF
  11. End Function
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1282
this computer was off and unplugged from any AC electricity source for at least 1month...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1282
@Midimaster>>
i use the AND operator quite often in Blitz3d...


good idea for the function, thanks
« Last Edit: April 19, 2021, 11:05:58 by RemiD »
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal