16namespace golxzn::os::chrono::utils {
19using floating_point_t = std::enable_if_t<std::is_floating_point_v<T>, T>;
25 std::chrono::high_resolution_clock,
26 std::chrono::steady_clock
29template<
class Clock,
class Minimum = std::micro>
30struct enough_resolution : std::bool_constant<std::ratio_less_equal_v<typename Clock::period, Minimum>> {};
33static constexpr bool enough_resolution_v{ enough_resolution<Clock>::value };
44template<
class T,
class Other>
45[[nodiscard]]
constexpr auto difference(
const Other ¤t,
const Other &last)
noexcept
46 -> std::conditional_t<std::is_constructible_v<T, std::chrono::microseconds>, T,
void> {
47 return T{ std::chrono::duration_cast<std::chrono::microseconds>(current - last) };
constexpr auto difference(const Other ¤t, const Other &last) noexcept -> std::conditional_t< std::is_constructible_v< T, std::chrono::microseconds >, T, void >
Time difference between two time points.
Definition utils.hpp:45
std::conditional_t< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock > default_base_clock
Default clock type.
Definition utils.hpp:27