tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
abs.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CHRONO_ABS_HPP
4#define TETL_CHRONO_ABS_HPP
5
10
11namespace etl::chrono {
12
17template <typename R, typename P>
20{
21 return d < duration<R, P>::zero() ? duration<R, P>::zero() - d : d;
22}
23
24} // namespace etl::chrono
25
26#endif // TETL_CHRONO_ABS_HPP
constexpr auto abs(duration< R, P > d) noexcept(is_arithmetic_v< R >) -> duration< R, P >
Returns the absolute value of the duration d. Specifically, if d >= d.zero(), return d,...
Definition abs.hpp:19
Definition abs.hpp:11
constexpr bool is_arithmetic_v
Definition is_arithmetic.hpp:21
Class template etl::chrono::duration represents a time interval.
Definition duration.hpp:31
static constexpr auto zero() noexcept -> duration
Returns a zero-length duration.
Definition duration.hpp:100
static constexpr bool is_signed
Definition numeric_limits.hpp:28