Subversion Repositories f9daq

Rev

Blame | Last modification | View Log | RSS feed

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4.  
  5. int main()
  6. {
  7.    FILE *fp, *fpout;
  8.  
  9.    fp = fopen("../dbg/time_offset.txt","r");
  10.    fpout = fopen("../dbg/time_offset_out.txt","w");
  11.  
  12.    int hosttime, hometime, difftime;
  13.    fscanf(fp, "%d\n%d", &hosttime, &hometime);
  14.  
  15.    if(hosttime >= hometime)
  16.    {
  17.       difftime = hosttime - hometime;
  18. //      printf("Host = %d\nHome = %d\nDifference = +%d\n", hosttime, hometime, difftime);
  19.       fprintf(fpout, "+%d", difftime);
  20.    }
  21.    else
  22.    {
  23.       difftime = hometime - hosttime;
  24. //      printf("Host = %d\nHome = %d\nDifference = -%d\n", hosttime, hometime, difftime);
  25.       fprintf(fpout, "-%d", difftime);
  26.    }
  27.  
  28.    fclose(fpout);
  29.    fclose(fp);
  30.  
  31.    return 0;
  32. }
  33.