CAF
0.17.6
|
Converts realtime into a series of ticks, whereas each tick represents a preconfigured timespan. More...
#include <tick_emitter.hpp>
Public Types | |
using | clock_type = std::chrono::steady_clock |
Discrete point in time. | |
using | time_point = typename clock_type::time_point |
Discrete point in time. | |
using | duration_type = typename time_point::duration |
Difference between two points in time. | |
Public Member Functions | |
tick_emitter (time_point now) | |
bool | started () const |
Queries whether the start time is non-default constructed. | |
void | start (time_point now) |
Configures the start time. | |
void | stop () |
Resets the start time to 0. | |
void | interval (duration_type x) |
Configures the time interval per tick. | |
duration_type | interval () const |
Returns the time interval per tick. | |
template<class F > | |
void | update (time_point now, F &consumer) |
Advances time and calls consumer for each emitted tick. | |
size_t | timeouts (time_point t, std::initializer_list< size_t > periods) |
Advances time by t and returns all triggered periods as bitmask. | |
time_point | next_timeout (time_point t, std::initializer_list< size_t > periods) |
Returns the next time point after t that would trigger any of the tick periods, i.e., returns the next time where any of the tick periods triggers tick id % period == 0 . More... | |
Converts realtime into a series of ticks, whereas each tick represents a preconfigured timespan.
For example, a tick emitter configured with a timespan of 25ms generates a tick every 25ms after starting it.
time_point caf::detail::tick_emitter::next_timeout | ( | time_point | t, |
std::initializer_list< size_t > | periods | ||
) |
Returns the next time point after t
that would trigger any of the tick periods, i.e., returns the next time where any of the tick periods triggers tick id % period == 0
.