Millisecs() = 0

Blitz3D Forums/Blitz3D Beginners Area/Millisecs() = 0

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

For more info on this subject, check out the topic linked below, and in particular, Floyds contribution.

http://www.blitzbasic.com/Community/posts.php?topic=49285#548324

Here's some testing code I made up while I was mucking around with this.

Graphics 800, 600, 0, 2

Const MAX_POSITIVE = 2147483647
Const MAX_NEGATIVE = -2147483648

current_time = MAX_POSITIVE
deadline_time = MAX_POSITIVE + 1

;current_time = -1
;deadline_time = 0

;Print "Millisecs() wrapover occurs every " + ( ( ( ( MAX_POSITIVE / 1000.0 ) / 60.0 ) / 60.0 ) / 24.0 ) + " days."
Print 
Print "current_time = " + current_time
Print "deadline_time = " + deadline_time
Print
Print "Time remaining = " + ( deadline_time - current_time )
Print

; -- Check if 'current_time' has exceeded 'deadline_time'. This should work even if one or both times have
;~ wrapped over to negative, or if one or both times have wrapped from negative to zero or positive.
;~ Substitute '>=' for '>' when testing if 'current_time' has reached or exceeded 'deadline_time'.
If ( current_time - deadline_time ) > 0
	Print "Timeout occurred"
Else
	Print "No timeout occurred"
EndIf 
;^^^^^^

WaitKey ()

End