micro-test-plus 4.1.0
µ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_TEST_PLUS_TIMINGS_INLINES_H_
31#define MICRO_TEST_PLUS_TIMINGS_INLINES_H_
32
33// ----------------------------------------------------------------------------
34
35#ifdef __cplusplus
36
37// ----------------------------------------------------------------------------
38
39#if defined(__GNUC__)
40#pragma GCC diagnostic push
41#if defined(__clang__)
42#pragma clang diagnostic ignored "-Wc++98-compat"
43#pragma clang diagnostic ignored "-Wpre-c++17-compat"
44#endif
45#endif
46
47// ============================================================================
48
50{
51 // ==========================================================================
52
57 inline timestamp::timestamp (const timespec& ts) noexcept : value_{ ts }
58 {
59 }
60
65 inline timespec&
66 timestamp::value () noexcept
67 {
68 return value_;
69 }
70
75 inline const timespec&
76 timestamp::value () const noexcept
77 {
78 return value_;
79 }
80
81 // ==========================================================================
82
88 inline bool
89 timestamps::has_begin () const noexcept
90 {
91 return begin_time_.has_value ();
92 }
93
99 inline bool
100 timestamps::has_end () const noexcept
101 {
102 return end_time_.has_value ();
103 }
104
105 // --------------------------------------------------------------------------
106} // namespace micro_os_plus::micro_test_plus::detail
107
108#if defined(__GNUC__)
109#pragma GCC diagnostic pop
110#endif
111
112// ----------------------------------------------------------------------------
113
114#endif // __cplusplus
115
116// ----------------------------------------------------------------------------
117
118#endif // MICRO_TEST_PLUS_TIMINGS_INLINES_H_
119
120// ----------------------------------------------------------------------------
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:176
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:338
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:333
Internal implementation details for the µTest++ framework.