#include <stdlib.h>
#include <stdio.h>
#include <time.h>


void main(int argc, char **argv) {
  //long dt[N];
  struct timespec ts1,ts2,tns1,tns2,tres;
  int err;
  int i;
  long dt,dtmax=0;
  int N;

  N=atoi(argv[1]);
  
  tns1.tv_sec=0;
  tns1.tv_nsec=1;

  //CLOCK_MONOTONIC_RAW
  clock_gettime(CLOCK_REALTIME,&ts1);
  for(i=0;i<N;i++) {
    //clock_gettime(CLOCK_MONOTONIC_RAW,&ts1);
    //err=clock_nanosleep(CLOCK_MONOTONIC_RAW,0,&tns1,&tns2);
    clock_gettime(CLOCK_REALTIME,&ts2);
    dt=(ts2.tv_sec - ts1.tv_sec)*1000000000+ts2.tv_nsec - ts1.tv_nsec;
    if(dt>dtmax) dtmax=dt;
    ts1=ts2;
    
  }
  printf("%9ld %d\n",dtmax,N);

  /*  clock_getres(CLOCK_MONOTONIC_RAW,&tres);
      printf("clock %ld %ld\n",tres.tv_sec,tres.tv_nsec); */
  exit(0);
}
