ITimer

Interface to the Timer System.

C++
struct ITimer {
  enum ETimer {
    ETIMER_GAME = 0,
    ETIMER_UI,
    ETIMER_LAST
  };
  enum ETimeScaleChannels {
    eTSC_Trackview = 0,
    eTSC_GameStart
  };
};
File

ITimer.h

ITimer::ETimer Enumeration
C++
enum ETimer {
  ETIMER_GAME = 0,
  ETIMER_UI,
  ETIMER_LAST
};
File

ITimer.h

Members
Members
Description
ETIMER_GAME = 0
Pausable, serialized, frametime is smoothed/scaled/clamped.
ETIMER_UI
Non-pausable, non-serialized, frametime unprocessed.
ITimer::ETimeScaleChannels Enumeration
C++
enum ETimeScaleChannels {
  eTSC_Trackview = 0,
  eTSC_GameStart
};
File

ITimer.h

ITimer::~ITimer Destructor
C++
virtual ~ITimer();
ITimer::ClearTimeScales Method

Clears all current time scale requests

C++
virtual void ClearTimeScales() = 0;
ITimer::CreateNewTimer Method

Create a new timer of the same type

C++
virtual ITimer* CreateNewTimer() = 0;
ITimer::DateToSecondsUTC Method

Makes a UTC time from a tm.

C++
virtual time_t DateToSecondsUTC(struct tm& timePtr) = 0;
Example

Like timegm, but not available on all platforms.

ITimer::EnableTimer Method

Enables/disables timer.

C++
virtual void EnableTimer(const bool bEnable) = 0;
ITimer::GetAsyncCurTime Method

Returns the absolute current time at the moment of the call.

C++
virtual float GetAsyncCurTime() = 0;
ITimer::GetAsyncTime Method

Returns the absolute current time. Notes: The value continuously changes, slower than GetFrameStartTime().

C++
virtual CTimeValue GetAsyncTime() const = 0;
See Also
ITimer::GetCurrTime Method

Returns the absolute time at the last UpdateOnFrameStart() call.

C++
virtual float GetCurrTime(ETimer which = ETIMER_GAME) const = 0;
Todo

Remove, use GetFrameStartTime() instead.

See Also
ITimer::GetFrameRate Method

Returns the current framerate in frames/second.

C++
virtual float GetFrameRate() = 0;
ITimer::GetFrameStartTime Method

Returns the absolute time at the last UpdateOnFrameStart() call.

C++
virtual const CTimeValue& GetFrameStartTime(ETimer which = ETIMER_GAME) const = 0;
See Also

UpdateOnFrameStart() virtual const CTimeValue& GetFrameStartTime(ETimer which = ETIMER_GAME) const = 0;

ITimer::GetFrameTime Method

Returns the relative time passed from the last UpdateOnFrameStart() in seconds.

C++
virtual float GetFrameTime(ETimer which = ETIMER_GAME) const = 0;
See Also
ITimer::GetProfileFrameBlending Method

Returns the fraction to blend current frame in profiling stats.

C++
virtual float GetProfileFrameBlending(float* pfBlendTime = 0, int* piBlendMode = 0) = 0;
ITimer::GetRealFrameTime Method
C++
virtual float GetRealFrameTime() const = 0;
Description

Returns the relative time passed from the last UpdateOnFrameStart() in seconds without any dilation, smoothing, clamping, etc...

See Also
ITimer::GetTicksPerSecond Method

Get number of ticks per second

C++
virtual int64 GetTicksPerSecond() = 0;
ITimer::GetTimeScale Method ()

Returns the time scale applied to time values.

C++
virtual float GetTimeScale() const = 0;
ITimer::GetTimeScale Method (uint32)

Returns the time scale factor for the given channel

C++
virtual float GetTimeScale(uint32 channel) const = 0;
ITimer::IsTimerEnabled Method
C++
virtual bool IsTimerEnabled() const = 0;
Returns

True if timer is enabled

ITimer::IsTimerPaused Method

Determines if a timer is paused.

C++
virtual bool IsTimerPaused(ETimer which) = 0;
Returns

True if paused, false otherwise.

ITimer::PauseTimer Method

Tries to pause/unpause a timer.

C++
virtual bool PauseTimer(ETimer which, bool bPause) = 0;
Returns

True if successfully paused/unpaused, false otherwise.

ITimer::ResetTimer Method

Resets the timer Notes: Only needed because float precision wasn't last that long - can be removed if 64bit is used everywhere.

C++
virtual void ResetTimer() = 0;
ITimer::SecondsToDateUTC Method

Makes a tm struct from a time_t in UTC

C++
virtual void SecondsToDateUTC(time_t time, struct tm& outDateUTC) = 0;
Example

Like gmtime.

ITimer::Serialize Method

Serialization.

C++
virtual void Serialize(TSerialize ser) = 0;
ITimer::SetTimer Method

Tries to set a timer.

C++
virtual bool SetTimer(ETimer which, float timeInSeconds) = 0;
Returns

True if successful, false otherwise.

ITimer::SetTimeScale Method

Sets the time scale applied to time values.

C++
virtual void SetTimeScale(float s, uint32 channel = 0) = 0;
ITimer::TicksToSeconds Method

Convert from ticks (CryGetTicks()) to seconds

C++
virtual float TicksToSeconds(int64 ticks) = 0;
ITimer::UpdateOnFrameStart Method

Updates the timer every frame, needs to be called by the system.

C++
virtual void UpdateOnFrameStart() = 0;