This simple snippet supplies 2 floating point functions with two integer equivelents to be used as a starting point when creating a value to be affected by a passage of time. For example, if a player must move 10 units per second, you can use the UnitsPerSec# function to return the required units given your current update duration, or the PerSec# function with a parameter used as the timespan.
Develop this further into something more complex and consistent when the need arises.
Global FrameTimespan
Global FrameStart
Do
FrameStart = Timer() // Use HiTimer() instead if you use Matrix1 because it is more accurate
// Update your engine
FrameTimespan = Timer() - FrameStart
Loop
//============================================================
Function UnitsPerSec#( fUnits# )
If fUnits# = 0 Then ExitFunction 0.0
Local fSpeed# : fSpeed# = fUnits# * 0.001
fSpeed# = fSpeed# * FrameTimespan
Endfunction fSpeed#
//============================================================
Function StepsPerSec( iSteps )
If iSteps = 0 Then ExitFunction 0
Local fSpeed# : fSpeed# = iSteps * 0.001
fSpeed# = fSpeed# * FrameTimespan
iSteps = fSpeed#
Endfunction iSteps
//============================================================
Function PerSec#( fUnits#, rate )
If fUnits# = 0 Then ExitFunction 0.0
Local fSpeed# : fSpeed# = fUnits# * 0.001
fSpeed# = fSpeed# * rate
Endfunction fSpeed#
//============================================================
Function PerSec( iSteps, rate )
If iSteps = 0 Then ExitFunction 0
Local fSpeed# : fSpeed# = iSteps * 0.001
fSpeed# = fSpeed# * rate
iSteps = fSpeed#
Endfunction iSteps
![](http://www.binarymodular.com/sfbanner3.png)