fix RageTimer::Half averaging backwards
cleanup comment
This commit is contained in:
@@ -73,20 +73,19 @@ float RageTimer::GetDeltaTime()
|
|||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a timer representing half of the time ago as this one. This is
|
/*
|
||||||
|
* Get a timer representing half of the time ago as this one. This is
|
||||||
* useful for averaging time. For example,
|
* useful for averaging time. For example,
|
||||||
*
|
*
|
||||||
* RageTimer tm;
|
* RageTimer tm;
|
||||||
* ... do stuff ...
|
* ... do stuff ...
|
||||||
* RageTimer AverageTime = tm.Half();
|
* RageTimer AverageTime = tm.Half();
|
||||||
* printf("Something happened between now and tm; the average time is %f.\n", tm.Ago());
|
* printf( "Something happened approximately %f seconds ago.\n", tm.Ago() );
|
||||||
* tm.Touch();
|
|
||||||
*/
|
*/
|
||||||
RageTimer RageTimer::Half() const
|
RageTimer RageTimer::Half() const
|
||||||
{
|
{
|
||||||
const RageTimer now;
|
const float fProbableDelay = Ago() / 2;
|
||||||
const float ProbableDelay = -(now - *this) / 2;
|
return *this + fProbableDelay;
|
||||||
return *this + ProbableDelay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user