OpenBarnyard
 
Loading...
Searching...
No Matches
THPTimer Class Reference

#include <THPTimer_Win.h>

Public Member Functions

 THPTimer ()
 
 ~THPTimer ()
 
TUINT32 GetRaw32 ()
 
int64_t GetRaw64 ()
 
void Update ()
 
void Reset ()
 
TFLOAT GetDelta () const
 
TFLOAT GetCurrentSeconds () const
 

Detailed Description

Definition at line 5 of file THPTimer_Win.h.

Constructor & Destructor Documentation

◆ THPTimer()

THPTimer::THPTimer ( )

Definition at line 15 of file THPTimer_Win.cpp.

16{
17 Reset();
18}
void Reset()

◆ ~THPTimer()

THPTimer::~THPTimer ( )

Definition at line 20 of file THPTimer_Win.cpp.

21{
22 Reset();
23}

Member Function Documentation

◆ GetCurrentSeconds()

TFLOAT THPTimer::GetCurrentSeconds ( ) const
inline

Definition at line 19 of file THPTimer_Win.h.

19{ return m_fCurrentSeconds; }

◆ GetDelta()

TFLOAT THPTimer::GetDelta ( ) const
inline

Definition at line 18 of file THPTimer_Win.h.

18{ return m_fDelta; }

◆ GetRaw32()

TUINT32 THPTimer::GetRaw32 ( )

Definition at line 25 of file THPTimer_Win.cpp.

26{
27 LARGE_INTEGER raw32;
28 QueryPerformanceCounter( &raw32 );
29 return static_cast<TUINT32>( raw32.QuadPart );
30}
uint32_t TUINT32
Definition Typedefs.h:13

◆ GetRaw64()

int64_t THPTimer::GetRaw64 ( )

Definition at line 32 of file THPTimer_Win.cpp.

33{
34 LARGE_INTEGER raw64;
35 QueryPerformanceCounter( &raw64 );
36 return raw64.QuadPart;
37}

◆ Reset()

void THPTimer::Reset ( )

Definition at line 40 of file THPTimer_Win.cpp.

41{
42 QueryPerformanceCounter( (LARGE_INTEGER*)&m_iCurrentTime );
43 QueryPerformanceFrequency( (LARGE_INTEGER*)&m_iFrequency );
44 m_iOldTime = m_iCurrentTime;
45 m_fDelta = 0;
46}

◆ Update()

void THPTimer::Update ( )

Definition at line 49 of file THPTimer_Win.cpp.

50{
51 m_iOldTime = m_iCurrentTime;
52 QueryPerformanceCounter( (LARGE_INTEGER*)&m_iCurrentTime );
53
54 double ratio = 1.0 / m_iFrequency;
55 m_fDelta = TFLOAT( ( m_iCurrentTime - m_iOldTime ) * ratio );
56 m_fCurrentSeconds = TFLOAT( m_iCurrentTime * ratio );
57}
float TFLOAT
Definition Typedefs.h:4

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