TermOx
Public Types | Public Member Functions | List of all members
ox::Timer Class Reference

Timer class where begin() and wait() are used to block for a given interval. More...

#include <timer.hpp>

Public Types

using Clock_t = std::chrono::steady_clock
 
using Time_point = Clock_t::time_point
 
using Duration_t = std::chrono::milliseconds
 

Public Member Functions

constexpr Timer (Duration_t interval)
 Construct a Timer with the given interval.
 
constexpr Timer (FPS fps)
 Construct a Timer with the given FPS interval.
 
void begin ()
 Start the timer, returns immediately.
 
void wait ()
 Sleep until the time interval is over, from last begin() call. More...
 
void set_interval (Duration_t interval)
 Set the amount of time to wait for from begin().
 
auto get_interval () const -> Duration_t
 Return the currently set interval.
 

Detailed Description

Timer class where begin() and wait() are used to block for a given interval.

Member Function Documentation

◆ wait()

void ox::Timer::wait ( )

Sleep until the time interval is over, from last begin() call.

Returns immediately if interval has already elapsed. Calling this without calling begin() first will return immediately.


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