Fix for tick intervals greater than one second.
authorSimon Marlow <marlowsd@gmail.com>
Mon, 16 Jan 2012 09:30:00 +0000 (09:30 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 16 Jan 2012 13:27:57 +0000 (13:27 +0000)
rts/posix/Itimer.c

index ece5491..d928147 100644 (file)
@@ -155,7 +155,7 @@ startTicker(void)
         struct itimerspec it;
         
         it.it_value.tv_sec  = TimeToSeconds(itimer_interval);
-        it.it_value.tv_nsec = TimeToNS(itimer_interval);
+        it.it_value.tv_nsec = TimeToNS(itimer_interval) % 1000000000;
         it.it_interval = it.it_value;
         
         if (timer_settime(timer, 0, &it, NULL) != 0) {
@@ -168,7 +168,7 @@ startTicker(void)
         struct itimerval it;
 
         it.it_value.tv_sec = TimeToSeconds(itimer_interval);
-        it.it_value.tv_usec = TimeToUS(itimer_interval);
+        it.it_value.tv_usec = TimeToUS(itimer_interval) % 1000000;
         it.it_interval = it.it_value;
         
         if (setitimer(ITIMER_REAL, &it, NULL) != 0) {