#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>

int main ()
{
  struct itimerval timer;
  double t1;
  unsigned int i;

  timer.it_value.tv_sec=60;
  timer.it_value.tv_usec=1000000;
  setitimer(ITIMER_REAL,&timer,NULL);
  for (i=1; i<10; i++)
    {
      getitimer(ITIMER_REAL,&timer);
      t1=((double)(timer.it_value.tv_sec))*1000000+(double)(timer.it_value.tv_usec);
      printf("%i: %li (s) %li (us) ",i,timer.it_value.tv_sec,timer.it_value.tv_usec);
      printf("%f\n",t1/1000000);
      sleep(1);
    }
  return 0;

}
