Subversion Repositories f9daq

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

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

int main()
{
   FILE *fp, *fpout;

   fp = fopen("../dbg/time_offset.txt","r");
   fpout = fopen("../dbg/time_offset_out.txt","w");

   int hosttime, hometime, difftime;
   fscanf(fp, "%d\n%d", &hosttime, &hometime);

   if(hosttime >= hometime)
   {
      difftime = hosttime - hometime;
//      printf("Host = %d\nHome = %d\nDifference = +%d\n", hosttime, hometime, difftime);
      fprintf(fpout, "+%d", difftime);
   }
   else
   {
      difftime = hometime - hosttime;
//      printf("Host = %d\nHome = %d\nDifference = -%d\n", hosttime, hometime, difftime);
      fprintf(fpout, "-%d", difftime);
   }

   fclose(fpout);
   fclose(fp);

   return 0;
}