sig_signal(SIGALRM, (void (*) (int)) TimerService); itimer.it_interval.tv_sec = itimer.it_value.tv_sec = 0; itimer.it_interval.tv_usec = itimer.it_value.tv_usec = TICKUNIT; if (setitimer(ITIMER_REAL, &itimer, NULL) == -1) log_Printf(LogERROR, "Unable to set itimer.\n");
if (TimerList) { if (!restart) sig_signal(SIGALRM, (void (*)(int))TimerService); itimer.it_interval.tv_sec = 0; itimer.it_interval.tv_usec = 0; itimer.it_value.tv_sec = TimerList->rest / SECTICKS; itimer.it_value.tv_usec = (TimerList->rest % SECTICKS) * TICKUNIT; if (setitimer(ITIMER_REAL, &itimer, NULL) == -1) log_Printf(LogERROR, "Unable to set itimer (%s)\n", sys_errlist[errno]); }
timer_InitService(){  struct itimerval itimer;  sig_signal(SIGALRM, (void (*) (int)) TimerService);  itimer.it_interval.tv_sec = itimer.it_value.tv_sec = 0;  itimer.it_interval.tv_usec = itimer.it_value.tv_usec = TICKUNIT;  if (setitimer(ITIMER_REAL, &itimer, NULL) == -1)    log_Printf(LogERROR, "Unable to set itimer.\n");}