Skip to content

File include/brisk/core/Time.hpp


toSeconds function

template <typename Rep, typename Period>
inline double
toSeconds(std::chrono::duration<Rep, Period> duration)

Converts a duration to seconds.

This function converts a given duration to a double value representing the number of seconds.
Param duration The duration to convert.
Returns The duration in seconds.


toHerzs function

template <typename Rep, typename Period>
inline double
toHerzs(std::chrono::duration<Rep, Period> duration)

Converts a duration to Hertz.

This function converts a given duration to a double value representing the frequency in Hertz.
Param duration The duration to convert.
Returns The frequency in Hertz.


appStartTime variable

extern Clock::time_point appStartTime

The start time of the application.


now function

inline Clock::time_point now() noexcept

Returns the current time.

This function retrieves the current time according to the steady clock.
Returns The current time point.


timeSinceStart function

inline Clock::duration timeSinceStart() noexcept

Returns the duration since the application started.
Returns The duration since the application start.


currentTime function

inline double currentTime() noexcept

Returns the duration since the application started in seconds.
Returns The duration in seconds.


SingleTimerThread class

SingleTimerThread

Represents a thread that handles a single timer.

This class provides a mechanism to run a timer in a separate thread. The timer will call a tick method periodically.

SingleTimerThread function (SingleTimerThread::SingleTimerThread)

explicit SingleTimerThread()

Constructs a SingleTimerThread instance and starts the thread.

This constructor initializes the thread and starts it, allowing it to handle timer events.

~SingleTimerThread function (SingleTimerThread::~SingleTimerThread)

~SingleTimerThread()

Destructor for the SingleTimerThread.

This destructor waits for the thread to finish execution before cleaning up resources.

terminate function (SingleTimerThread::terminate)

void terminate()

Terminates the timer thread.

This method signals the thread to stop but doesn't wait for it to terminate.

tick function (SingleTimerThread::tick)

virtual void tick(Clock::time_point &time)

Virtual function called in a cycle.

This method must be overridden to handle periodic events. It sets the time parameter to the next desired call time.
Param time The time point to be set for the next call.


PeriodicTimer class

PeriodicTimer

Represents a periodic timer.

This structure provides functionality to manage a timer that triggers events at regular intervals.

PeriodicTimer function (PeriodicTimer::PeriodicTimer)

PeriodicTimer(bool startNow = true)

Constructs a PeriodicTimer and optionally starts it immediately.
Param startNow If true, the timer starts immediately.

elapsed function (PeriodicTimer::elapsed)

bool elapsed(double period)

Checks if the specified period has elapsed.
Param period The period to check.
Returns True if the period has elapsed; otherwise, false.

active function (PeriodicTimer::active)

bool active() const

Checks if the timer is currently active.
Returns True if the timer is active; otherwise, false.

start function (PeriodicTimer::start)

void start()

Starts the periodic timer.

stop function (PeriodicTimer::stop)

void stop()

Stops the periodic timer.

time variable (PeriodicTimer::time)

double time

The time period for the timer.


PerformanceStatistics class

PerformanceStatistics

TimeSlice class (PerformanceStatistics::TimeSlice)

TimeSlice

Stopwatch class

Stopwatch

fromJson function (std::chrono::fromJson)

template <typename Rep, typename Period>
inline bool fromJson(const Brisk::Json &j,
                     duration<Rep, Period> &dur)

Converts a JSON value to a chrono duration.
Param j The JSON value to convert.
Param dur The resulting chrono duration.
Returns True if conversion is successful; otherwise, false.


toJson function (std::chrono::toJson)

template <typename Rep, typename Period>
inline bool toJson(Brisk::Json &j,
                   const duration<Rep, Period> &dur)

Converts a chrono duration to a JSON value.
Param j The resulting JSON value.
Param dur The chrono duration to convert.
Returns True if conversion is successful; otherwise, false.


fromJson function (std::chrono::fromJson)

template <typename Clock, typename Duration>
inline bool fromJson(const Brisk::Json &j,
                     time_point<Clock, Duration> &time)

Converts a JSON value to a chrono time point.
Param j The JSON value to convert.
Param time The resulting chrono time point.
Returns True if conversion is successful; otherwise, false.


toJson function (std::chrono::toJson)

template <typename Clock, typename Duration>
inline bool toJson(Brisk::Json &j,
                   const time_point<Clock, Duration> &time)

Converts a chrono time point to a JSON value.
Param j The resulting JSON value.
Param time The chrono time point to convert.
Returns True if conversion is successful; otherwise, false.


Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/