v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | List of all members
Sifteo::TimeStep Class Reference

TimeStep is a higher-level utility for keeping track of time the duration of game timesteps. More...

#include <sifteo/time.h>

Public Member Functions

SystemTime begin () const
 Retrieve the SystemTime at the beginning of the interval described by delta(). More...
 
TimeDelta delta () const
 Retrieve the duration of the last time interval. More...
 
SystemTime end () const
 Retrieve the SystemTime at the end of the interval described by delta(). More...
 
void next ()
 Advance to the next time interval. More...
 

Detailed Description

TimeStep is a higher-level utility for keeping track of time the duration of game timesteps.

At any time, delta() can be used to retrieve the duration of the last timestep, as a TimeDelta object. The next() call ends the current timestep and begins the next one simultaneously, without losing any time in-between.

TimeStep is guaranteed not to inclur cumulative rounding errors due to loss of precision when converting SystemTime into TimeDelta.

Member Function Documentation

SystemTime Sifteo::TimeStep::begin ( ) const
inline

Retrieve the SystemTime at the beginning of the interval described by delta().

This is the time at the second to last call to next(), which must have been called at least twice.

TimeDelta Sifteo::TimeStep::delta ( ) const
inline

Retrieve the duration of the last time interval.

If less than two calls to next() have elapsed, this returns a zero-length interval.

SystemTime Sifteo::TimeStep::end ( ) const
inline

Retrieve the SystemTime at the end of the interval described by delta().

This is the time at the last call to next(), which must have been called at least once.

void Sifteo::TimeStep::next ( )
inline

Advance to the next time interval.

This samples the system clock, as the end of the previous interval and the beginning of the next.


The documentation for this class was generated from the following file: