styyx-util 1.0
Utility Header for SKSE Plugin development
Loading...
Searching...
No Matches
StyyxUtil::TimerUtil Struct Reference

Timer class used to do x after y time. More...

#include <st-timer.h>

Public Member Functions

void Start ()
 Start the timer.
void Stop ()
 Stop the timer.
void Reset ()
 Reset timer. Basically set it back to 0.
double ElapsedSeconds () const
 Get the time the timer runs for.
bool IsRunning () const
 Check if the timer is running or not.
void StartLimited (double a_seconds)
 Start a time for a limited amount of time.
bool IsExpired ()
 Check if a limited timer has ran out or not.
double RemainingSeconds () const
 Get the remaining seconds a limited timer runs for.

Private Attributes

bool limited { false }
double limitSeconds {0.0}
std::chrono::steady_clock::time_point startTime {}
bool running {false}

Detailed Description

Timer class used to do x after y time.

Example
timer.Start();
// check if elapsed
if (timer.Elapsed() >= 5.0) {
// do something
}
Timer class used to do x after y time.
Definition st-timer.h:15
void Start()
Start the timer.
Definition st-timer.h:19

Member Function Documentation

◆ ElapsedSeconds()

double StyyxUtil::TimerUtil::ElapsedSeconds ( ) const
inlinenodiscard

Get the time the timer runs for.

Returns
double for the elapsed seconds
Here is the caller graph for this function:

◆ IsExpired()

bool StyyxUtil::TimerUtil::IsExpired ( )
inline

Check if a limited timer has ran out or not.

Returns
true if the limited timer is run out
Here is the call graph for this function:

◆ IsRunning()

bool StyyxUtil::TimerUtil::IsRunning ( ) const
inlinenodiscard

Check if the timer is running or not.

Returns
bool true if the timer is running

◆ RemainingSeconds()

double StyyxUtil::TimerUtil::RemainingSeconds ( ) const
inlinenodiscard

Get the remaining seconds a limited timer runs for.

Returns
double for the remaining seconds a limited timer has left
Here is the call graph for this function:

◆ Reset()

void StyyxUtil::TimerUtil::Reset ( )
inline

Reset timer. Basically set it back to 0.

◆ Start()

void StyyxUtil::TimerUtil::Start ( )
inline

Start the timer.

◆ StartLimited()

void StyyxUtil::TimerUtil::StartLimited ( double a_seconds)
inline

Start a time for a limited amount of time.

Parameters
a_secondsamount of time the timer will run for

◆ Stop()

void StyyxUtil::TimerUtil::Stop ( )
inline

Stop the timer.

Here is the caller graph for this function:

Member Data Documentation

◆ limited

bool StyyxUtil::TimerUtil::limited { false }
private

◆ limitSeconds

double StyyxUtil::TimerUtil::limitSeconds {0.0}
private

◆ running

bool StyyxUtil::TimerUtil::running {false}
private

◆ startTime

std::chrono::steady_clock::time_point StyyxUtil::TimerUtil::startTime {}
private

The documentation for this struct was generated from the following file: