"L. Spiro Engine"
Public Member Functions | Protected Attributes

lsstd::CTime Class Reference

High-resolution time class. More...

#include <LSSTDTime.h>

List of all members.

Public Member Functions

LSE_INLINE LSUINT64 LSE_CALL GetCurMicros () const
LSE_INLINE LSUINT64 LSE_CALL GetCurVirtMicros () const
LSE_INLINE LSUINT64 LSE_CALL GetCurMills () const
LSE_INLINE LSUINT64 LSE_CALL GetCurVirtMills () const
LSE_INLINE LSUINT32 LSE_CALL GetCurFrame () const
LSE_INLINE LSUINT32 LSE_CALL GetCurVirtFrame () const
LSE_INLINE LSUINT64 LSE_CALL GetMicrosSinceLastFrame () const
LSE_INLINE LSUINT64 LSE_CALL GetVirtMicrosSinceLastFrame () const
LSE_INLINE LSUINT64 LSE_CALL GetMillsSinceLastFrame () const
LSE_INLINE LSUINT64 LSE_CALL GetVirtMillsSinceLastFrame () const
LSE_INLINE LSFLOAT LSE_CALL GetSecondsSinceLastFrame () const
LSE_INLINE LSFLOAT LSE_CALL GetVirtSecondsSinceLastFrame () const
LSE_INLINE LSUINT64 LSE_CALL GetTicksSinceLastFrame () const
LSE_INLINE LSUINT64 LSE_CALL GetCurTicks () const
LSVOID LSE_CALL Reset ()
LSVOID LSE_CALL Update (LSBOOL _bUpdateVirtuals)
LSVOID LSE_CALL UpdateBy (LSUINT64 _ui64Amnt, LSBOOL _bUpdateVirtuals)
LSVOID LSE_CALL UpdateByConstantTime (LSUINT64 _ui64Amnt, LSBOOL _bUpdateVirtuals)
LSUINT32 LSE_CALL GetConstantStepUpdateTimesFromTicks (LSUINT64 _ui64Ticks, LSUINT32 &_ui32UnitsToNextUpdate)
LSUINT64 LSE_CALL MicrosToTicks (LSUINT64 _ui64Amnt) const
LSUINT64 LSE_CALL GetRealTime () const

Protected Attributes

LSUINT64 m_ui64Resolution
LSUINT64 m_ui64CurTime
LSUINT64 m_ui64LastTime
LSUINT64 m_ui64CurVirtTime
LSUINT64 m_ui64LastVirtTime
LSUINT64 m_ui64LastRealTime
LSUINT64 m_ui64CurMicros
LSUINT64 m_ui64LastMicros
LSUINT64 m_ui64CurVirtMicros
LSUINT64 m_ui64LastVirtMicros
LSUINT32 m_ui32Frame
LSUINT32 m_ui32VirtFrame
LSBOOL m_bHiRes

Detailed Description

High-resolution time class.

Class CTime Description: Cross-platform time-management. Tracks time in microseconds (1,000,000 per second). Also provides frame count and virtual time/frame values for pausing. When paused, virtual values re not updated, causing any objects/systems using the virtual time values to stop (effectively pausing them). Use the regular time values for systems that cannot be paused, such as the menus, which should flash and animate regardless of the pause status.


Member Function Documentation

LSUINT32 LSE_CALL lsstd::CTime::GetConstantStepUpdateTimesFromTicks ( LSUINT64  _ui64Ticks,
LSUINT32 &  _ui32UnitsToNextUpdate 
)

Get the number of cycles and amount of tick updates needed to advance the time by the constant time step given.

Parameters:
_ui64TicksNumber of ticks by which to update the time. Must be a constant number, used for every call to this function for a given instance. The time is not updated by this amount, but instead returns the number of updates needed to make the timer approximately current by this value.
_ui32UnitsToNextUpdateHolds a returned value indicating the number of 1,000th units that would need to pass for another update to happen at the given tick rate.
Returns:
Returns the number of iterations needed to advance the time so that, if advanced by the given tick amount by the returned number of times, the timer will be approximately current.
LSE_INLINE LSUINT32 LSE_CALL lsstd::CTime::GetCurFrame ( ) const

Get the current frame.

Returns:
Returns the frame count.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetCurMicros ( ) const

Get the current microseconds.

Returns:
Returns an LSUINT64 value containing the current microseconds.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetCurMills ( ) const

Get the current milliseconds.

Returns:
Returns an LSUINT64 value containing the current milliseconds.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetCurTicks ( ) const

Get the current number of ticks. Ticks are machine-dependent and should not be used for tracking time.

Returns:
Returns the current tick count of this timer.
LSE_INLINE LSUINT32 LSE_CALL lsstd::CTime::GetCurVirtFrame ( ) const

Get the current virtual frame.

Returns:
Returns the virtual frame count.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetCurVirtMicros ( ) const

Get the current virtual microseconds.

Returns:
Returns an LSUINT64 value containing the current virtual microseconds
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetCurVirtMills ( ) const

Get the current virtual milliseconds.

Returns:
Returns an LSUINT64 value containing the current virtual milliseconds.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetMicrosSinceLastFrame ( ) const

Get the microseconds since last frame.

Returns:
Returns the number of microseconds since the last frame.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetMillsSinceLastFrame ( ) const

Get the milliseconds since last frame.

Returns:
Returns the number of milliseconds since the last frame.
LSUINT64 LSE_CALL lsstd::CTime::GetRealTime ( ) const

Get the real system time. Not to be used for any other purpose besides random-number seeding.

Returns:
Returns the real system time in system tick units.
LSE_INLINE LSFLOAT LSE_CALL lsstd::CTime::GetSecondsSinceLastFrame ( ) const

Get the seconds since last frame as a floating-point value.

Returns:
Returns the number of seconds since the last frame.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetTicksSinceLastFrame ( ) const

Get the actual amount of time passed since last frame. This value should never be used. The amount of time it measures changes per device/hardware. It is not useful for telling time.

Returns:
Returns the number of ticks since the last frame. Resolution depends on hardware.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetVirtMicrosSinceLastFrame ( ) const

Get the virtual microseconds since last frame.

Returns:
Returns the number of virtual microseconds since the last frame.
LSE_INLINE LSUINT64 LSE_CALL lsstd::CTime::GetVirtMillsSinceLastFrame ( ) const

Get the virtual milliseconds since last frame.

Returns:
Returns the number of virtual milliseconds since the last frame.
LSE_INLINE LSFLOAT LSE_CALL lsstd::CTime::GetVirtSecondsSinceLastFrame ( ) const

Get the virtual seconds since last frame as a floating-point value..

Returns:
Returns the number of virtual seconds since the last frame.
LSUINT64 LSE_CALL lsstd::CTime::MicrosToTicks ( LSUINT64  _ui64Amnt) const

Convert microseconds to tick values used by this timer internally.

Parameters:
_ui64AmntThe value to convert.
Returns:
Returns the number of ticks that roughly equal the given amount of microseconds.
LSVOID LSE_CALL lsstd::CTime::Reset ( )

Reset the time. Causes it to begin ticking all values from 0.

LSVOID LSE_CALL lsstd::CTime::Update ( LSBOOL  _bUpdateVirtuals)

Update the time.

Parameters:
_bUpdateVirtualsIf true, virtual values are updated as well.
LSVOID LSE_CALL lsstd::CTime::UpdateBy ( LSUINT64  _ui64Amnt,
LSBOOL  _bUpdateVirtuals 
)

Update the time by a certain amount.

Parameters:
_ui64AmntNumber of ticks by which to update the time.
_bUpdateVirtualsIf true, virtual values are updated as well.
LSVOID LSE_CALL lsstd::CTime::UpdateByConstantTime ( LSUINT64  _ui64Amnt,
LSBOOL  _bUpdateVirtuals 
)

Update by a constant time factor given in ticks. Used in conjunction with GetConstantStepUpdateTimesFromTicks().

Parameters:
_ui64AmntNumber of ticks by which to update the time.
_bUpdateVirtualsIf true, virtual values are updated as well.

Member Data Documentation

Are we high-resolution enabled?

LSUINT32 lsstd::CTime::m_ui32Frame [protected]

Frame count.

LSUINT64 lsstd::CTime::m_ui64CurMicros [protected]

Current microseconds.

LSUINT64 lsstd::CTime::m_ui64CurTime [protected]

Current time (starts at 0).

LSUINT64 lsstd::CTime::m_ui64CurVirtMicros [protected]

Current virtual microseconds.

LSUINT64 lsstd::CTime::m_ui64CurVirtTime [protected]

Virtual ticks.

LSUINT64 lsstd::CTime::m_ui64LastMicros [protected]

Last microseconds.

LSUINT64 lsstd::CTime::m_ui64LastRealTime [protected]

Record of the last real time (to handle integer overflow).

LSUINT64 lsstd::CTime::m_ui64LastTime [protected]

Time last update.

LSUINT64 lsstd::CTime::m_ui64LastVirtMicros [protected]

Last virtual microseconds.

LSUINT64 lsstd::CTime::m_ui64Resolution [protected]

Timer resolution.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator