ITimer

Interface to the Timer System. More...

#include

Public Types

enum ETimer { ETIMER_GAME = 0, ETIMER_UI, ETIMER_LAST }
enum ETimeScaleChannels { eTSC_Trackview = 0, eTSC_GameStart }

Public Member Functions

virtual void ResetTimer ()=0
virtual void UpdateOnFrameStart ()=0
Updates the timer every frame, needs to be called by the system.
virtual float GetCurrTime (ETimer which=ETIMER_GAME) const =0
Returns the absolute time at the last UpdateOnFrameStart() call.
virtual const CTimeValue & GetFrameStartTime (ETimer which=ETIMER_GAME) const =0
Returns the absolute time at the last UpdateOnFrameStart() call.
virtual CTimeValue GetAsyncTime () const =0
virtual float GetAsyncCurTime ()=0
Returns the absolute current time at the moment of the call.
virtual float GetReplicationTime () const =0
Returns sum of relative time passed at each frame.
virtual float GetFrameTime (ETimer which=ETIMER_GAME) const =0
Returns the relative time passed from the last UpdateOnFrameStart() in seconds.
virtual float GetRealFrameTime () const =0
Returns the relative time passed from the last UpdateOnFrameStart() in seconds without any dilation, smoothing, clamping, etc...
virtual float GetTimeScale () const =0
Returns the time scale applied to time values.
virtual float GetTimeScale (uint32 channel) const =0
Returns the time scale factor for the given channel.
virtual void ClearTimeScales ()=0
Clears all current time scale requests.
virtual void SetTimeScale (float s, uint32 channel=0)=0
Sets the time scale applied to time values.
virtual void EnableTimer (const bool bEnable)=0
Enables/disables timer.
virtual bool IsTimerEnabled () const =0
virtual float GetFrameRate ()=0
Returns the current framerate in frames/second.
virtual float GetProfileFrameBlending (float *pfBlendTime=0, int *piBlendMode=0)=0
Returns the fraction to blend current frame in profiling stats.
virtual void Serialize (TSerialize ser)=0
Serialization.
virtual bool PauseTimer (ETimer which, bool bPause)=0
virtual bool IsTimerPaused (ETimer which)=0
virtual bool SetTimer (ETimer which, float timeInSeconds)=0
virtual void SecondsToDateUTC (time_t time, struct tm &outDateUTC)=0
virtual time_t DateToSecondsUTC (struct tm &timePtr)=0
virtual void SetFixedFrameTime (float time)
virtual float TicksToSeconds (int64 ticks) const =0
Convert from ticks (CryGetTicks()) to seconds.
virtual int64 GetTicksPerSecond ()=0
Get number of ticks per second.
virtual ITimer * CreateNewTimer ()=0
Create a new timer of the same type.

Detailed Description

Interface to the Timer System.

Member Enumeration Documentation

◆ ETimer

Enumerator
ETIMER_GAME

Pausable, serialized, frametime is smoothed/scaled/clamped.

ETIMER_UI

Non-pausable, non-serialized, frametime unprocessed.

Member Function Documentation

◆ DateToSecondsUTC()

virtual time_t ITimer::DateToSecondsUTC ( struct tm & timePtr)
pure virtual

Makes a UTC time from a tm. Example: Like timegm, but not available on all platforms.

◆ GetAsyncTime()

virtual CTimeValue ITimer::GetAsyncTime ( ) const
pure virtual

Returns the absolute current time.

Note
The value continuously changes, slower than GetFrameStartTime().

◆ IsTimerEnabled()

virtual bool ITimer::IsTimerEnabled ( ) const
pure virtual
Returns
True if timer is enabled

◆ IsTimerPaused()

virtual bool ITimer::IsTimerPaused ( ETimer which)
pure virtual

Determines if a timer is paused.

Returns
true if paused, false otherwise.

◆ PauseTimer()

virtual bool ITimer::PauseTimer ( ETimer which,
bool bPause
)
pure virtual

Tries to pause/unpause a timer.

Returns
true if successfully paused/unpaused, false otherwise.

◆ ResetTimer()

virtual void ITimer::ResetTimer ( )
pure virtual

Resets the timer

Note
Only needed because float precision wasn't last that long - can be removed if 64bit is used everywhere.

◆ SecondsToDateUTC()

virtual void ITimer::SecondsToDateUTC ( time_t time,
struct tm & outDateUTC
)
pure virtual

Makes a tm struct from a time_t in UTC Example: Like gmtime.

◆ SetTimer()

virtual bool ITimer::SetTimer ( ETimer which,
float timeInSeconds
)
pure virtual

Tries to set a timer.

Returns
true if successful, false otherwise.