micro-test-plus 5.0.1
µTest++ Testing Framework
Loading...
Searching...
No Matches
timings-inlines.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can be
9 * obtained from https://opensource.org/licenses/mit.
10 */
11
12// ----------------------------------------------------------------------------
13
29
30#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_TIMINGS_INLINES_H_
31#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_TIMINGS_INLINES_H_
32
33// ----------------------------------------------------------------------------
34
35#if defined(__cplusplus)
36
37// ----------------------------------------------------------------------------
38
39#if defined(__GNUC__)
40#pragma GCC diagnostic push
41
42#if defined(__clang__)
43#pragma clang diagnostic ignored "-Wc++98-compat"
44#pragma clang diagnostic ignored "-Wpre-c++17-compat"
45#endif // defined(__clang__)
46#endif // defined(__GNUC__)
47
48// ============================================================================
49
51{
52 // ==========================================================================
53
58 inline timestamp::timestamp (const timespec& ts) noexcept : value_{ ts }
59 {
60 }
61
66 inline timespec&
67 timestamp::value () noexcept
68 {
69 return value_;
70 }
71
76 inline const timespec&
77 timestamp::value () const noexcept
78 {
79 return value_;
80 }
81
82 // ==========================================================================
83
89 inline bool
90 timestamps::has_begin () const noexcept
91 {
92 return begin_time_.has_value ();
93 }
94
100 inline bool
101 timestamps::has_end () const noexcept
102 {
103 return end_time_.has_value ();
104 }
105
106 // --------------------------------------------------------------------------
107} // namespace micro_os_plus::micro_test_plus::detail
108
109#if defined(__GNUC__)
110#pragma GCC diagnostic pop
111#endif // defined(__GNUC__)
112
113// ----------------------------------------------------------------------------
114
115#endif // defined(__cplusplus)
116
117// ----------------------------------------------------------------------------
118
119#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_TIMINGS_INLINES_H_
120
121// ----------------------------------------------------------------------------
timestamp() noexcept
Default constructor. Zero-initialises the internal timespec.
Definition timings.cpp:71
timespec & value() noexcept
Returns a mutable reference to the underlying timespec value.
timespec value_
The underlying timespec value.
Definition timings.h:185
bool has_end() const noexcept
Returns true if the end timestamp has been recorded.
std::optional< timestamp > end_time_
The timestamp recorded at the end of the test suite.
Definition timings.h:347
bool has_begin() const noexcept
Returns true if the begin timestamp has been recorded.
std::optional< timestamp > begin_time_
The timestamp recorded at the beginning of the test suite.
Definition timings.h:342
Internal implementation details for the µTest++ framework.