Smoothing Delta Timing

Miscellaneous Forums/General Discussion/Smoothing Delta Timing

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.

Here is why you need integers. A float cannot exactly represent a large integer value. If your computer has been running for at least 2^24 milliseconds ( about 280 minutes ) then timer values are already too big for a float.

After a time difference has been calculated you can use a float for the resulting small integer value.

This example shows the time calculation failing with floats. It will work if msec1 and msec2 are integers.
msec1# = 16800000   ; Two large integer values. As floats they are
msec2# = 16800001   ; equal so the difference is zero.

mdiff# = msec2 - msec1

Print "delta time = " + mdiff

WaitKey