summaryrefslogtreecommitdiffhomepage
path: root/compat/timer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/timer.hpp')
-rw-r--r--compat/timer.hpp7
1 files changed, 4 insertions, 3 deletions
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);