39#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_STOPWATCH_H_
40#define MICRO_OS_PLUS_MICRO_TEST_PLUS_STOPWATCH_H_
44#if defined(__cplusplus)
48#if __has_include("micro-os-plus/project-config.h")
49#include "micro-os-plus/project-config.h"
52#if __has_include("micro-os-plus/micro-test-plus-defines.h")
53#include "micro-os-plus/micro-test-plus-defines.h"
63#pragma GCC diagnostic push
66#pragma clang diagnostic ignored "-Wc++98-compat"
67#pragma clang diagnostic ignored "-Wpre-c++17-compat"
206 start (
void)
noexcept;
221 stop (
void)
noexcept;
251 [[nodiscard]] std::chrono::microseconds
254#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
273 [[deprecated (
"use has_elapsed() (since 6.0.0)"), nodiscard]]
bool
290 [[deprecated (
"use has_elapsed() (since 6.0.0)"), nodiscard]]
bool
304 [[deprecated (
"use has_elapsed() (since 6.0.0)"), nodiscard]]
bool
323 [[deprecated (
"use elapsed() (since 6.0.0)")]]
void
325 uint32_t& microseconds)
const noexcept;
343 [[deprecated (
"use start() (since 6.0.0)")]]
void
359 [[deprecated (
"use start() (since 6.0.0)")]]
void
376 [[deprecated (
"use stop() (since 6.0.0)")]]
void
392 [[deprecated (
"use stop() (since 6.0.0)")]]
void
421 [[nodiscard]]
static bool
448#pragma GCC diagnostic pop
static bool is_recorded(const timespec &ts) noexcept
Checks whether a clock reading was recorded.
stopwatch(stopwatch &&)=delete
Deleted move constructor to prevent moving.
bool has_begin(void) const noexcept
Deprecated check of the start reading.
std::chrono::microseconds elapsed(void) const noexcept
Returns the time elapsed between start() and stop().
bool has_elapsed(void) const noexcept
Checks whether the elapsed time is available.
stopwatch(const stopwatch &)=delete
Deleted copy constructor to prevent copying.
void timestamp_end(void) noexcept
Deprecated recording of the stop time, from the system clock.
stopwatch(void)=default
Default constructor.
timespec start_time_
The clock reading at the start of the measured interval.
void timestamp_begin(void) noexcept
Deprecated recording of the start time, from the system clock.
void stop(void) noexcept
Records the stop time, from the system clock.
bool has_timestamps(void) const noexcept
Deprecated name of has_elapsed().
stopwatch & operator=(const stopwatch &)=delete
Deleted copy assignment operator to prevent copying.
friend struct stopwatch_test_access
The unit tests helper, which sets known readings.
bool has_end(void) const noexcept
Deprecated check of the stop reading.
~stopwatch()=default
Defaulted destructor.
void start(void) noexcept
Records the start time, from the system clock.
timespec stop_time_
The clock reading at the end of the measured interval.
void compute_elapsed_time(uint32_t &milliseconds, uint32_t µseconds) const noexcept
Deprecated split of the elapsed time.
Internal implementation details for the µTest++ framework.
void read_clock(timespec &ts) noexcept
Reads the system clock.
Primary namespace for the µTest++ testing framework.
C++ header file with inline implementations for the µTest++ stopwatch.