/* This program reads the GPS clock and corrects the system clock based on the GPS clock. It will wake up once an hour in order to check the clock. If the clock has lost sync, it aborts. Planned improvement: if timesync has been lost, it will call the NIST or Nautical Observatory phone line to check the time. 1999_11_22 Eliminated CTS10 related code to transport to Linux. 10Oct2000 Change from WWV to GPS clock. */ #include #include #include #include #include void log_entry( char *comment ); main() { int i,j; char c,str[100]; system("date -u\n"); printf("\n Is this time correct within one minute (y/n)?"); if ('n' == getc(stdin)) { printf("Please login as superuser, set the system clock using the command\n"); printf("date -u mmddhhmmyy.ss\n"); printf(" , and run clock again.\n"); exit(1); }; getc(stdin); /* Catch the CR */ printf("\n Synchronizing system clock from TrueTime GPS (wall) Clock\n"); printf(" The task number is "); fflush(stdout); system("gpssync &"); printf("\n\n"); log_entry( "clock" ); exit(0); }