diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-04-16 17:20:31 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-04-16 17:20:31 +0200 |
commit | 4f31165ef67837ca9e4a9677b19082c023a3c931 (patch) | |
tree | 100bb3085003116ba965a6028cbfdde0ba12cc6c /compat/timer.hpp | |
parent | 286e57d9e597f4821b17bf07c0686f75257bbc3d (diff) |
compat/timer: simplify stuff
Diffstat (limited to 'compat/timer.hpp')
-rw-r--r-- | compat/timer.hpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/compat/timer.hpp b/compat/timer.hpp index d162a949..c107d28d 100644 --- a/compat/timer.hpp +++ b/compat/timer.hpp @@ -12,30 +12,23 @@ #include "time.hpp" #include <ctime> +#include <cstdint> #include <type_traits> struct OTR_COMPAT_EXPORT Timer final { - using time_type = time_t; + using time_type = std::int64_t; Timer(); void start(); - template<typename t> - constexpr auto elapsed() const - { - 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); - time_type conv_nsecs(const struct timespec& cur) const; + struct timespec gettime_() const; using ns = time_units::ns; }; |