title: timer_gettime not working with multiple timers
body: <p>The issue is that I am trying to run a code which can trigger different timers at the same time. That is, when 3 is typed by the user, the firstimer is triggered. If before expiration another 3 is introduced, the second timer will be launched, and the difference between both triggers will be shown. Under this circumstance, timer_gettime only works once. I tried all the things I could imagine but still, it_value_tv_sec and _nsec return zero after the first expiration.</p>
  
  <p>Here is the code I am testing:</p>
  
  <p>Thank you in advance!</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;time.h&gt;
  
  
  timer_t firstTimerID;
  timer_t secondTimerID;
  timer_t thirdTimerID;
  timer_t fourthTimerID;
  int z=0;
  int a=0;
  int t_block3=4;
  float delay_blocks;
  
  struct itimerspec it;
  struct itimerspec its;
  
  static void timerHandler( int sig, siginfo_t *si, void *uc )
  {
      timer_t *tidp;
  
      tidp = si-&gt;si_value.sival_ptr;
  
      if ( *tidp == firstTimerID ){
          printf("First timer\n");
      }
      else if ( *tidp == secondTimerID ){
          printf("Second timer\n");
      }
      else if ( *tidp == thirdTimerID ){
          printf("Third timer\n");
      }
      else if ( *tidp == fourthTimerID ){
          printf("Fourth timer\n");
      }
  
      z--;
      printf("%d", z);
  
  }
  
  static int makeTimer( timer_t *timerID, int time)
  {
      struct sigevent te;
      struct itimerspec its;
      struct sigaction sa;
      int sigNo = SIGRTMIN;
  
      // Set up signal handler.
      sa.sa_flags = SA_SIGINFO; 
      sa.sa_sigaction = timerHandler; //Action when singal is triggered
      sigemptyset(&amp;sa.sa_mask);
      if (sigaction(sigNo, &amp;sa, NULL) == -1) {
          perror("sigaction");
      }
  
      // Set and enable alarm 
      te.sigev_notify = SIGEV_SIGNAL; //Gnerate alarm upon expiration
      te.sigev_signo = sigNo; //SIGALRM
      te.sigev_value.sival_ptr = timerID; //Timer ID
      //Create a per_process timer using the timer ID
      timer_create(CLOCK_REALTIME, &amp;te, timerID);
  
      //Interval for starting again 
      its.it_interval.tv_sec = 0 ;
      its.it_interval.tv_nsec = 0;
      //Timer time
      its.it_value.tv_sec = time;
      its.it_value.tv_nsec = 0;
      //Arm/disarmer a per process time
      timer_settime(*timerID, 0, &amp;its, NULL);
  
      return 1;
  }
  
  int main(){
  
  while (1){
      printf("Enter the number of the block\n");
      if (scanf(" %d", &amp;a) == 1){
  
      switch(a){
      case 3: printf("Block number three, belt will proceed to stop in 12 seconds\n");
              if (z==0){                  
              makeTimer(&amp;firstTimerID, t_block3);
              }else if (z==1){
                  makeTimer(&amp;secondTimerID, 4);
                  timer_gettime(&amp;firstTimerID,&amp;it);
                  delay_blocks=t_block3-(it.it_value.tv_sec+(it.it_value.tv_nsec*0.000000001));
                  printf("Difference between the first and the second timer = %f\n", delay_blocks);
  
              }else if (z==2){
              makeTimer(&amp;thirdTimerID, 4);
              }else if (z==3){
              makeTimer(&amp;fourthTimerID, 4);
              }
              z++;
              break;
  
      case 2: printf("Block number two, belt will proceed to stop in 10 seconds\n");
                      //sleep(1);
                      break;
  
      case 4: printf("Block number four, belt won't stop\n");
                      //sleep(1);
                      break;
      default:printf("Wrong lecture\n");
  
      }
      }
  
  }
  
  }
  </code></pre>
  
  <p>I have also tried using timer_delete once the first signal is received, but in that case, always gettime is called, it returns the same value, not matter if it is the same time or the third.</p>