ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ticks.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of the \aliblong. It does not belong to an \alibmod and is
4/// included in any \alibbuild.
5///
6/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
7/// Published under \ref mainpage_license "Boost Software License".
8//==================================================================================================
9ALIB_EXPORT namespace alib { namespace time {
10//==================================================================================================
11/// This class provides an interface into system-dependent steady, monotonic timer values, which are
12/// independent of the system's clock settings, hence independent of changes of the clock
13/// by the user, by external clock synchronization using the internet, GPS, mobile network, etc.
14///
15/// Usually, this class is used to measure and store durations (e.g., with inherited method
16/// \alib{time::TimePointBase;Age}).
17/// As tick values are not just system-dependent, but even usually change with a reboot of a system,
18/// they should not be stored and loaded in data files or otherwise shared between systems.
19///
20/// In contrast to sibling type \alib{time;DateTime}, this class is also missing conversion methods
21/// with types that represent "human" calendar dates and a clock times.
22/// However, in some situations it still may be needed to convert the points in time measured with
23/// this class to human-readable date and time representations.
24/// For this purpose, class \alib{time;TickConverter} allows converting objects of this type to
25/// objects of sibling type \b %DateTime, which then can be further converted to system-dependent
26/// calendar dates and clock times.
27///
28/// The class has no specific interface, but the methods and operators inherited from base
29/// \alib{time;TimePointBase}.
30/// @see
31/// For this class, a \ref alibtools_debug_helpers_gdb "pretty printer" for the
32/// GNU debugger is provided.
33//==================================================================================================
34class Ticks : public TimePointBase<std::chrono::steady_clock, Ticks>
35{
36 public:
37//! @cond NO_DOX
38// doxygen bug: generates "return type not documented"
39 /// Use constructors of parent class.
41//! @endcond
42
43
44 /// Equal to operator.
45 /// @param other The time stamp to compare.
46 /// @return The result of the comparison.
47 bool operator==( const Ticks& other ) const { return stamp == other.stamp; }
48
49
50 /// Not equal to operator.
51 /// @param other The time stamp to compare.
52 /// @return The result of the comparison.
53 bool operator!=( const Ticks& other ) const { return stamp != other.stamp; }
54
55 /// Less than operator.
56 /// @param other The time stamp to compare.
57 /// @return A reference to this object.
58 bool operator<( const Ticks& other ) const { return stamp < other.stamp; }
59
60 /// Less than or equal to operator.
61 /// @param other The time stamp to compare.
62 /// @return The result of the comparison.
63 bool operator<=( const Ticks& other ) const { return stamp <= other.stamp; }
64
65 /// Greater than operator.
66 /// @param other The time stamp to compare.
67 /// @return The result of the comparison.
68 bool operator>( const Ticks& other ) const { return stamp > other.stamp; }
69
70 /// Greater than or equal to operator.
71 /// @param other The time stamp to compare.
72 /// @return The result of the comparison.
73 bool operator>=( const Ticks& other ) const { return stamp >= other.stamp; }
74};
75
76} // namespace alib[::time]
77
78/// Type alias in namespace \b alib.
80
81} // namespace [alib]
bool operator>=(const Ticks &other) const
Definition ticks.inl:73
bool operator<=(const Ticks &other) const
Definition ticks.inl:63
bool operator==(const Ticks &other) const
Definition ticks.inl:47
bool operator<(const Ticks &other) const
Definition ticks.inl:58
bool operator!=(const Ticks &other) const
Definition ticks.inl:53
bool operator>(const Ticks &other) const
Definition ticks.inl:68
constexpr TimePointBase(const lang::Initialization init=lang::Initialization::Default)
#define ALIB_EXPORT
Definition alib.inl:497
time::Ticks Ticks
Type alias in namespace alib.
Definition ticks.inl:79