summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-08-03 04:43:28 +0000
committerStanislaw Halik <sthalik@misaki.pl>2018-08-04 13:41:56 +0000
commitc172c327c2b927427c24a7e3a5f345673d0e5929 (patch)
treed1e2d0a1fcb3619bfa0b453b743db78b37e2b727 /compat
parente841b3324655b5862dc6d79d482b2af474239791 (diff)
logic/pipeline: rotation order fixrevert-geometry-stuff
v2: fix comments v3: fix reltrans
Diffstat (limited to 'compat')
-rw-r--r--compat/time.hpp6
-rw-r--r--compat/timer.hpp7
2 files changed, 4 insertions, 9 deletions
diff --git a/compat/time.hpp b/compat/time.hpp
index 64cdc6f7..0d171038 100644
--- a/compat/time.hpp
+++ b/compat/time.hpp
@@ -7,12 +7,6 @@ namespace time_units {
template<typename repr, typename ratio = std::ratio<1>>
using duration = std::chrono::duration<repr, ratio>;
-template<typename t, typename u>
-static inline constexpr auto time_cast(u&& in)
-{
- return std::chrono::duration_cast<t>(in);
-}
-
using secs = duration<float>;
using ms = duration<float, std::milli>;
using us = duration<float, std::micro>;
diff --git a/compat/timer.hpp b/compat/timer.hpp
index 26e612b0..d162a949 100644
--- a/compat/timer.hpp
+++ b/compat/timer.hpp
@@ -22,16 +22,17 @@ struct OTR_COMPAT_EXPORT Timer final
void start();
template<typename t>
- t elapsed() const
+ constexpr auto elapsed() const
{
- using namespace time_units;
- return time_cast<t>(ns(elapsed_nsecs()));
+ using ns = time_units::ns;
+ return t{ns{elapsed_nsecs()}};
}
time_type elapsed_nsecs() const;
double elapsed_usecs() const;
double elapsed_ms() const;
double elapsed_seconds() const;
+
private:
struct timespec state {};
static void gettime(struct timespec* state);