TermOx
fps.hpp
1 #ifndef TERMOX_COMMON_FPS_HPP
2 #define TERMOX_COMMON_FPS_HPP
3 #include <cstdint>
4 
5 namespace ox {
6 
8 struct FPS {
9  std::uint16_t value;
10 };
11 
13 
14 template <typename Duration_t>
15 [[nodiscard]] constexpr auto fps_to_period(FPS fps) -> Duration_t
16 {
17  return Duration_t{static_cast<typename Duration_t::rep>(
18  (1. / fps.value) * Duration_t::period::den)};
19 }
20 
21 } // namespace ox
22 #endif // TERMOX_COMMON_FPS_HPP
Frames Per Second.
Definition: fps.hpp:8