Fix nanoseconds for timer setup using seconds

This commit is contained in:
Bob Polis 2024-01-31 16:02:58 +01:00
parent 2e0a4dce54
commit c88aa8f04f

View File

@ -13,7 +13,7 @@ void sc::timer::callback(union sigval sv) {
void sc::timer::setup_timer(double time, bool repeat) { void sc::timer::setup_timer(double time, bool repeat) {
time_t secs = floor(time); time_t secs = floor(time);
long ns = (time - secs) * 1000000; long ns = (time - secs) * 1000000000;
struct itimerspec its; struct itimerspec its;
its.it_value.tv_sec = secs; its.it_value.tv_sec = secs;
its.it_value.tv_nsec = ns; its.it_value.tv_nsec = ns;