Skip to main content

timestamp Class

Deprecated clock reading. More...

Declaration​

class micro_os_plus::micro_test_plus::detail::timestamp { ... }

Included Headers​

Public Constructors Index​

timestamp (const timespec &ts) noexcept

Constructs a timestamp with a given time. More...

timestamp (const timestamp &)=default

Defaulted copy constructor. More...

timestamp (timestamp &&)=default

Defaulted move constructor. More...

timestamp (void) noexcept

Constructs a timestamp with the current time. More...

Public Destructor Index​

~timestamp ()=default

Defaulted destructor. More...

Public Operators Index​

timestamp &operator= (const timestamp &)=default

Defaulted copy assignment operator. More...

timestamp &operator= (timestamp &&)=default

Defaulted move assignment operator. More...

Public Member Functions Index​

boolhas_clock (void) const noexcept

Checks whether the value is a clock reading. More...

const timespec &value (void) const noexcept

Returns the stored time. More...

timespec &value (void) noexcept

Returns the stored time, for modification. More...

Protected Member Attributes Index​

timespecvalue_ {}

The stored time. More...

Description​

Deprecated clock reading.

The v5.0.1 class of the two readings kept by detail::timestamps, restored for the applications that used it directly; the framework no longer uses it, since stopwatch keeps the readings as timespec members. The timings are internal; use stopwatch instead.

A zero timespec means that the clock was not read, or that the platform has no clock.

The data member is protected, as in v5.0.1, so that the existing derived classes can still access it.

Deprecated

the timings are internal (since 6.0.0)

Definition at line 2335 of file deprecated.h.

Public Constructors​

timestamp()​

micro_os_plus::micro_test_plus::detail::timestamp::timestamp (const timespec & ts)
inline noexcept

Constructs a timestamp with a given time.

Not explicit, as in v5.0.1, so that a timespec converts implicitly.

Parameters
ts

The time to be stored.

Copies ts into the stored value.

Declaration at line 2356 of file deprecated.h, definition at line 1297 of file deprecated-inlines.h.

1297 inline timestamp::timestamp (const timespec& ts) noexcept : value_{ ts }
1298 {
1299 }

References timestamp and value_.

timestamp()​

micro_os_plus::micro_test_plus::detail::timestamp::timestamp (const timestamp &)
default

Defaulted copy constructor.

A timestamp is a plain value, so it may be copied.

Definition at line 2364 of file deprecated.h.

timestamp()​

micro_os_plus::micro_test_plus::detail::timestamp::timestamp (timestamp &&)
default

Defaulted move constructor.

Equivalent to the copy, since the value is trivially copyable.

Definition at line 2372 of file deprecated.h.

Reference timestamp.

timestamp()​

micro_os_plus::micro_test_plus::detail::timestamp::timestamp (void)
noexcept

Constructs a timestamp with the current time.

Reads the system clock, as stopwatch::start() does; without a clock, the value remains zero.

Reads the system clock into the stored value, with read_clock(), the same clock as stopwatch; without a clock, the value remains zero.

Declaration at line 2345 of file deprecated.h, definition at line 100 of file deprecated.cpp.

100 timestamp::timestamp (void) noexcept
101 {
103 }

References micro_os_plus::micro_test_plus::detail::read_clock and value_.

Referenced by timestamp, timestamp, ~timestamp, operator= and operator=.

Public Destructor​

~timestamp()​

micro_os_plus::micro_test_plus::detail::timestamp::~timestamp ()
default

Defaulted destructor.

No resources are owned, so there is nothing to release.

Definition at line 2405 of file deprecated.h.

Reference timestamp.

Public Operators​

operator=()​

timestamp & micro_os_plus::micro_test_plus::detail::timestamp::operator= (const timestamp &)
default

Defaulted copy assignment operator.

A timestamp is a plain value, so it may be assigned.

Returns

A reference to the current object.

Definition at line 2383 of file deprecated.h.

Reference timestamp.

operator=()​

timestamp & micro_os_plus::micro_test_plus::detail::timestamp::operator= (timestamp &&)
default

Defaulted move assignment operator.

Equivalent to the copy assignment, since the value is trivially copyable.

Returns

A reference to the current object.

Definition at line 2396 of file deprecated.h.

Reference timestamp.

Public Member Functions​

has_clock()​

bool micro_os_plus::micro_test_plus::detail::timestamp::has_clock (void)
inline nodiscard noexcept

Checks whether the value is a clock reading.

The value is not a reading if both its members are zero.

Parameters

None.

Return Values
true

At least one of the members is not zero.

false

Both members are zero.

Returns true if either the seconds or the nanoseconds member is not zero.

Declaration at line 2419 of file deprecated.h, definition at line 1309 of file deprecated-inlines.h.

1309 timestamp::has_clock (void) const noexcept
1310 {
1311 return value_.tv_sec != 0 || value_.tv_nsec != 0;
1312 }

References has_clock and value_.

Referenced by has_clock.

value()​

const timespec & micro_os_plus::micro_test_plus::detail::timestamp::value (void)
inline nodiscard noexcept

Returns the stored time.

Parameters

None.

Returns

A constant reference to the stored timespec.

The returned reference is valid as long as the object exists.

Declaration at line 2439 of file deprecated.h, definition at line 1334 of file deprecated-inlines.h.

1334 timestamp::value (void) const noexcept
1335 {
1336 return value_;
1337 }

References value and value_.

value()​

timespec & micro_os_plus::micro_test_plus::detail::timestamp::value (void)
inline nodiscard noexcept

Returns the stored time, for modification.

Parameters

None.

Returns

A reference to the stored timespec.

The caller may modify the stored time through the returned reference.

Declaration at line 2429 of file deprecated.h, definition at line 1322 of file deprecated-inlines.h.

1322 timestamp::value (void) noexcept
1323 {
1324 return value_;
1325 }

References value and value_.

Referenced by value and value.

Protected Member Attributes​

value_​

timespec micro_os_plus::micro_test_plus::detail::timestamp::value_ {}
protected

The stored time.

Set by the constructors; zero if the clock was not read.

Definition at line 2448 of file deprecated.h.

Referenced by timestamp, timestamp, has_clock, value and value.


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


Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.