11 constexpr auto operator""_Ts(
long double time)
noexcept -> ice::Ts;
12 constexpr auto operator""_Ts(
unsigned long long time)
noexcept -> ice::Ts;
13 constexpr auto operator""_Tms(
unsigned long long time)
noexcept -> ice::Tms;
14 constexpr auto operator""_Tus(
unsigned long long time)
noexcept -> ice::Tus;
15 constexpr auto operator""_Tns(
unsigned long long time)
noexcept -> ice::Tns;
27 constexpr operator Tms() const noexcept;
28 constexpr operator
Tus() const noexcept;
29 constexpr operator
Tns() const noexcept;
44 constexpr operator Ts() const noexcept;
45 constexpr operator
Tus() const noexcept;
46 constexpr operator
Tns() const noexcept;
62 constexpr operator Ts() const noexcept;
63 constexpr explicit operator
Tms() const noexcept;
64 constexpr operator
Tns() const noexcept;
79 constexpr operator Ts() const noexcept;
80 constexpr explicit operator
Tms() const noexcept;
81 constexpr explicit operator
Tus() const noexcept;
115 concept TimeType = std::is_same_v<T, Ts> || std::is_same_v<T, Tms> || std::is_same_v<T, Tus> || std::is_same_v<T, Tns>;
120 template<ice::TimeType T0, ice::TimeType T1>
123 using HighestPrecision = std::conditional_t<T0::Constant_Precision >= T1::Constant_Precision, T0, T1>;
124 using LowestPrecision = std::conditional_t<T0::Constant_Precision <= T1::Constant_Precision, T0, T1>;
127 template<ice::TimeType T0, ice::TimeType T1>
130 template<ice::TimeType T0, ice::TimeType T1>
138 Type
const left_op = left;
139 Type
const right_op = right;
140 return left_op.value <=> right_op.value;
146 Type
const left_op = left;
147 Type
const right_op = right;
148 return Type{ left_op.value + right_op.value };
154 Type
const left_op = left;
155 Type
const right_op = right;
156 return Type{ left_op.value - right_op.value };
162 Type
const left_op = (Type) left;
163 Type
const right_op = (Type) right;
164 return left_op.value == right_op.value;
167 constexpr auto operator""_Ts(
long double time)
noexcept ->
ice::Ts
172 constexpr auto operator""_Ts(
unsigned long long time)
noexcept ->
ice::Ts
177 constexpr auto operator""_Tms(
unsigned long long time)
noexcept ->
ice::Tms
182 constexpr auto operator""_Tus(
unsigned long long time)
noexcept ->
ice::Tus
187 constexpr auto operator""_Tns(
unsigned long long time)
noexcept ->
ice::Tns
199 static_assert(1.0_Ts == 1_Ts);
202 static_assert(1_Ts == 1000_Tms);
203 static_assert(1_Ts == 1000'000_Tus);
204 static_assert(1_Ts == 1000'000'000_Tns);
205 static_assert(0.001_Ts == 1_Tms);
206 static_assert(0.001_Ts == 1000_Tus);
207 static_assert(0.001_Ts == 1000'000_Tns);
208 static_assert(0.000'001_Ts == 1_Tus);
209 static_assert(0.000'001_Ts == 1000_Tns);
210 static_assert(0.000'000'001_Ts == 1_Tns);
212 static_assert(1_Ts == 1000_Tms);
213 static_assert(1_Ts == 1000'000_Tus);
214 static_assert(1_Ts == 1000'000'000_Tns);
216 static_assert(1_Tms == 0.001_Ts);
217 static_assert(1_Tms == 1000_Tus);
218 static_assert(1_Tms == 1000'000_Tns);
220 static_assert(1_Tus == 0.000'001_Ts);
221 static_assert(1_Tus == 0_Tms);
222 static_assert(1_Tus == 1000_Tns);
224 static_assert(1_Tns == 0.000'000'001_Ts);
225 static_assert(1_Tns == 0_Tms);
226 static_assert(1_Tns == 0_Tus);
228 static_assert(1_Tns + 1_Tns == 2_Tns);
229 static_assert(1_Tns + 1_Tus == 1001_Tns);
230 static_assert(1_Tns + 1_Tms == 1000'001_Tns);
232 static_assert(1_Ts + 1_Tms == 1001_Tms);
233 static_assert(1_Ts + 1_Tus == 1000'001_Tus);
234 static_assert(1_Ts + 1_Tns == 1000'000'001_Tns);
236 static_assert(1_Ts - 1_Tms == 999_Tms);
237 static_assert(1_Ts - 1_Tus == 999'999_Tus);
238 static_assert(1_Ts - 1_Tns == 999'999'999_Tns);
240 static_assert(2_Tms - 1_Tms == 1_Tms);
241 static_assert(2_Tms - 1_Tus == 1'999_Tus);
242 static_assert(2_Tms - 1_Tns == 1'999'999_Tns);
244 static_assert(1_Tns * 2 == 2_Tns);
245 static_assert(1_Tus * 2 == 2_Tus);
246 static_assert(1_Tms * 2 == 2_Tms);
248 static_assert(2_Tms * 2 - 1_Tms == 3_Tms);
249 static_assert(2_Tms * 2 - 1_Tus == 3'999_Tus);
250 static_assert(2_Tms * 2 - 1_Tns == 3'999'999_Tns);
Definition clock_types.hxx:115
Definition clock_types.hxx:197
Definition hashmap_details.hxx:13
typename TimeTypeTraits< T0, T1 >::HighestPrecision TTHighestPrecisionType
Definition clock_types.hxx:128
typename TimeTypeTraits< T0, T1 >::LowestPrecision TTLowestPrecisionType
Definition clock_types.hxx:131
SPDX-License-Identifier: MIT.
Definition array.hxx:12
constexpr auto operator<=>(ice::TimeType auto left, TimeType auto right) noexcept
Definition clock_types.hxx:135
constexpr auto operator-(ice::TimeType auto left, TimeType auto right) noexcept
Definition clock_types.hxx:151
constexpr auto operator==(ice::TimeType auto left, TimeType auto right) noexcept
Definition clock_types.hxx:159
static constexpr ice::detail::TTLowestPrecisionType< Tms, Tus > t0
Definition clock_types.hxx:193
double f64
Definition types.hxx:17
std::int64_t i64
Definition types.hxx:22
static constexpr Tns t1
Definition clock_types.hxx:194
constexpr auto operator+(ice::TimeType auto left, TimeType auto right) noexcept
Definition clock_types.hxx:143
Represent the current systems clock frequency. Can be used to transform timestamps to time values.
Definition clock_types.hxx:92
ice::f64 value
Definition clock_types.hxx:92
Type tag to enable utility functions for strongly typed numeric values.
Definition strong_type_integral.hxx:11
Represents platform native timestamp with undefined representation.
Definition clock_types.hxx:89
ice::i64 value
Definition clock_types.hxx:89
Represents time interval of milliseconds.
Definition clock_types.hxx:38
ice::StrongNumeric TypeTag
Definition clock_types.hxx:39
static constexpr ValueType Constant_Precision
Definition clock_types.hxx:48
ValueType value
Definition clock_types.hxx:42
ice::i64 ValueType
Definition clock_types.hxx:40
Represents time interval of nanoseconds.
Definition clock_types.hxx:73
ice::StrongNumeric TypeTag
Definition clock_types.hxx:74
static constexpr ValueType Constant_Precision
Definition clock_types.hxx:83
ValueType value
Definition clock_types.hxx:77
ice::i64 ValueType
Definition clock_types.hxx:75
Represents time interval of seconds.
Definition clock_types.hxx:21
ValueType value
Definition clock_types.hxx:25
ice::StrongNumeric TypeTag
Definition clock_types.hxx:22
ice::f64 ValueType
Definition clock_types.hxx:23
static constexpr ValueType Constant_Precision
Definition clock_types.hxx:31
Represents time interval of microseconds.
Definition clock_types.hxx:56
static constexpr ValueType Constant_Precision
Definition clock_types.hxx:66
ice::StrongNumeric TypeTag
Definition clock_types.hxx:57
ValueType value
Definition clock_types.hxx:60
ice::i64 ValueType
Definition clock_types.hxx:58
Definition clock_types.hxx:122
std::conditional_t< T0::Constant_Precision<=T1::Constant_Precision, T0, T1 > LowestPrecision
Definition clock_types.hxx:124
std::conditional_t< T0::Constant_Precision >=T1::Constant_Precision, T0, T1 > HighestPrecision
Definition clock_types.hxx:123