Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
toolbox::sys::CyclTime Class Reference

#include <toolbox/sys/Time.hpp>

Public Member Functions

MonoTime mono_time () const noexcept
 
WallTime wall_time () const noexcept
 
void set_wall_time (WallTime wall_time) noexcept
 

Static Public Member Functions

static CyclTime current () noexcept
 
static CyclTime now () noexcept
 
static CyclTime now (WallTime wall_time) noexcept
 This overload allows users to override wall-clock time.
 

Detailed Description

The "cycle-time" represents the start of a processing cycle. This could be, for example, when a thread wakes from a call to epoll_wait().

Application cycles often require both wall-clock and monotonic time. (Monotonic is primarily used for interval timers.) Rather than pass wall-clock and monotonic time as a parameter down through the function call-tree, these times are cached in a thread-local object.

The CyclTime tag type (empty class) is designed to make the thread-local programming contract more explicit, without consuming extra registers required for parameter passing - assuming that the optimiser will optimise-away empty tag parameters.

Definition at line 126 of file Time.hpp.

Member Function Documentation

◆ current()

static CyclTime toolbox::sys::CyclTime::current ( )
inlinestaticnoexcept

Definition at line 128 of file Time.hpp.

◆ now() [1/2]

static CyclTime toolbox::sys::CyclTime::now ( )
inlinestaticnoexcept

◆ now() [2/2]

static CyclTime toolbox::sys::CyclTime::now ( WallTime  wall_time)
inlinestaticnoexcept

This overload allows users to override wall-clock time.

Definition at line 135 of file Time.hpp.

◆ mono_time()

MonoTime toolbox::sys::CyclTime::mono_time ( ) const
inlinenoexcept

Definition at line 140 of file Time.hpp.

Referenced by toolbox::io::TimerQueue::dispatch(), and toolbox::io::Reactor::poll().

◆ wall_time()

WallTime toolbox::sys::CyclTime::wall_time ( ) const
inlinenoexcept

Definition at line 141 of file Time.hpp.

◆ set_wall_time()

void toolbox::sys::CyclTime::set_wall_time ( WallTime  wall_time)
inlinenoexcept

Definition at line 142 of file Time.hpp.


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