- cdtime_t interval;
- struct timespec ts = {0, 0};
- int status = 0;
-
- interval = plugin_get_interval();
- CDTIME_T_TO_TIMESPEC(interval, &ts);
-
- while (42) {
- struct timespec rem = {0, 0};
-
- status = nanosleep(&ts, &rem);
- if (status == 0)
- break;
- else if ((errno == EINTR) || (errno == EAGAIN)) {
- ts = rem;
+ struct timespec ts = CDTIME_T_TO_TIMESPEC(plugin_get_interval());
+ while (nanosleep(&ts, &ts) != 0) {
+ if ((errno == EINTR) || (errno == EAGAIN))