Change interface, more logical naming
This commit is contained in:
		| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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; } | ||||
|     }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user