⏱️ golxzn::os::chrono ⏱️ 1.2.4
Chrono for golxzn's projects.
Loading...
Searching...
No Matches
utils.hpp File Reference

Useful functions and aliases for golxzn::os::chrono. More...

#include <chrono>
#include <utility>
#include <type_traits>

Go to the source code of this file.

Typedefs

using golxzn::os::chrono::utils::default_base_clock = std::conditional_t< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock >
 Default clock type.
 

Functions

template<class T , class Other >
constexpr auto golxzn::os::chrono::utils::difference (const Other &current, const Other &last) noexcept -> std::conditional_t< std::is_constructible_v< T, std::chrono::microseconds >, T, void >
 Time difference between two time points.
 

Detailed Description

Useful functions and aliases for golxzn::os::chrono.

Author
Ruslan Golovinskii (golxz.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-10-24

Function Documentation

◆ difference()

template<class T , class Other >
constexpr auto golxzn::os::chrono::utils::difference ( const Other &  current,
const Other &  last 
) -> std::conditional_t<std::is_constructible_v<T, std::chrono::microseconds>, T, void>
constexprnoexcept

Time difference between two time points.

Template Parameters
Treturn type
Parameters
currentcurrent time (usually std::chrono::time_point)
lastlast time (usually std::chrono::time_point)
Returns
constexpr T
See also
golxzn::os::chrono::utils::base_clock