Forbid copying, moving; Add overrun getter

This commit is contained in:
Bob Polis 2024-01-31 14:39:46 +01:00
parent fe3e0dd068
commit 2aa529ebf1
2 changed files with 14 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include <cmath> #include <cmath>
#include <ctime>
#include <libscerror.hpp> #include <libscerror.hpp>
#include "timer.hpp" #include "timer.hpp"
@ -90,3 +91,7 @@ void sc::timer::start(double time, bool repeat) {
setup_timer(time, repeat); setup_timer(time, repeat);
} }
} }
int sc::timer::overrun() const {
return timer_getoverrun(_tid);
}

View File

@ -26,6 +26,14 @@ namespace sc {
void* context = nullptr); void* context = nullptr);
~timer(); ~timer();
// forbid copying
timer(const timer&) = delete;
timer& operator=(const timer&) = delete;
// forbid moveing
timer(timer&&) = delete;
timer& operator=(timer&&) = delete;
uint64_t id() const { return _id; } uint64_t id() const { return _id; }
double time() const { return _time; } double time() const { return _time; }
bool repeat() const { return _repeat; } bool repeat() const { return _repeat; }
@ -34,6 +42,7 @@ namespace sc {
bool is_armed() const; bool is_armed() const;
void time_left(struct itimerspec& cur_value) const; void time_left(struct itimerspec& cur_value) const;
double time_left() const; double time_left() const;
int overrun() const;
void stop(); void stop();
void start(); void start();