diff --git a/src/timer.cpp b/src/timer.cpp index 612a6be..9c37fa2 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -40,18 +40,18 @@ sc::timer::~timer() { timer_delete(_tid); } -void sc::timer::time(struct itimerspec& cur_value) const { +void sc::timer::time_left(struct itimerspec& cur_value) const { throw_if_min1_msg(timer_gettime(_tid, &cur_value), "could not get time"); } -double sc::timer::time() const { +double sc::timer::time_left() const { struct itimerspec its; - time(its); + time_left(its); return its.it_value.tv_sec + its.it_value.tv_nsec * 1000000000; } bool sc::timer::is_armed() const { struct itimerspec its; - time(its); + time_left(its); return its.it_value.tv_sec != 0 || its.it_value.tv_nsec != 0; } diff --git a/src/timer.hpp b/src/timer.hpp index e10f8ae..f28c5ee 100644 --- a/src/timer.hpp +++ b/src/timer.hpp @@ -19,8 +19,9 @@ namespace sc { timer(void(*callback)(union sigval), double time, bool repeat = false); ~timer(); - void time(struct itimerspec& cur_value) const; - double time() const; + void time_left(struct itimerspec& cur_value) const; + double time_left() const; + double time() const { return _time; } bool is_armed() const; bool repeat() const { return _repeat; } };