Interface to the Timer System.
struct ITimer { enum ETimer { ETIMER_GAME = 0, ETIMER_UI, ETIMER_LAST }; enum ETimeScaleChannels { eTSC_Trackview = 0, eTSC_GameStart }; };
ITimer.h
enum ETimer { ETIMER_GAME = 0, ETIMER_UI, ETIMER_LAST };
ITimer.h
Members |
Description |
ETIMER_GAME = 0 |
Pausable, serialized, frametime is smoothed/scaled/clamped. |
ETIMER_UI |
Non-pausable, non-serialized, frametime unprocessed. |
enum ETimeScaleChannels { eTSC_Trackview = 0, eTSC_GameStart };
ITimer.h
virtual ~ITimer();
Clears all current time scale requests
virtual void ClearTimeScales() = 0;
Create a new timer of the same type
virtual ITimer* CreateNewTimer() = 0;
Makes a UTC time from a tm.
virtual time_t DateToSecondsUTC(struct tm& timePtr) = 0;
Like timegm, but not available on all platforms.
Enables/disables timer.
virtual void EnableTimer(const bool bEnable) = 0;
Returns the absolute current time at the moment of the call.
virtual float GetAsyncCurTime() = 0;
Returns the absolute current time. Notes: The value continuously changes, slower than GetFrameStartTime().
virtual CTimeValue GetAsyncTime() const = 0;
Returns the absolute time at the last UpdateOnFrameStart() call.
virtual float GetCurrTime(ETimer which = ETIMER_GAME) const = 0;
Remove, use GetFrameStartTime() instead.
Returns the current framerate in frames/second.
virtual float GetFrameRate() = 0;
Returns the absolute time at the last UpdateOnFrameStart() call.
virtual const CTimeValue& GetFrameStartTime(ETimer which = ETIMER_GAME) const = 0;
UpdateOnFrameStart() virtual const CTimeValue& GetFrameStartTime(ETimer which = ETIMER_GAME) const = 0;
Returns the relative time passed from the last UpdateOnFrameStart() in seconds.
virtual float GetFrameTime(ETimer which = ETIMER_GAME) const = 0;
Returns the fraction to blend current frame in profiling stats.
virtual float GetProfileFrameBlending(float* pfBlendTime = 0, int* piBlendMode = 0) = 0;
virtual float GetRealFrameTime() const = 0;
Returns the relative time passed from the last UpdateOnFrameStart() in seconds without any dilation, smoothing, clamping, etc...
Get number of ticks per second
virtual int64 GetTicksPerSecond() = 0;
Returns the time scale applied to time values.
virtual float GetTimeScale() const = 0;
Returns the time scale factor for the given channel
virtual float GetTimeScale(uint32 channel) const = 0;
virtual bool IsTimerEnabled() const = 0;
True if timer is enabled
Determines if a timer is paused.
virtual bool IsTimerPaused(ETimer which) = 0;
True if paused, false otherwise.
Tries to pause/unpause a timer.
virtual bool PauseTimer(ETimer which, bool bPause) = 0;
True if successfully paused/unpaused, false otherwise.
Resets the timer Notes: Only needed because float precision wasn't last that long - can be removed if 64bit is used everywhere.
virtual void ResetTimer() = 0;
Makes a tm struct from a time_t in UTC
virtual void SecondsToDateUTC(time_t time, struct tm& outDateUTC) = 0;
Like gmtime.
Serialization.
virtual void Serialize(TSerialize ser) = 0;
Tries to set a timer.
virtual bool SetTimer(ETimer which, float timeInSeconds) = 0;
True if successful, false otherwise.
Sets the time scale applied to time values.
virtual void SetTimeScale(float s, uint32 channel = 0) = 0;
Convert from ticks (CryGetTicks()) to seconds
virtual float TicksToSeconds(int64 ticks) = 0;
Updates the timer every frame, needs to be called by the system.
virtual void UpdateOnFrameStart() = 0;