/* This program reads the WWV clock and corrects the system clock based on the WWV 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. This version of clock asks for a manual synchronization to the nearest second before calling the routine "nosync" which periodically applies a constant correction to the computer clock. JSW 12June00 */ #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 second (y/n)?"); if ('n' == getc(stdin)) { printf("Please log in as root and set the system clock\n"); printf(" with following the command:\n"); printf("date -u mmddhhmmyy.ss\n"); printf("and run clock again.\n"); exit(1); }; getc(stdin); /* Catch the CR */ printf("\n Periodically correcting the system clock by a constant\n"); printf(" amount."); printf(" The task number is "); fflush(stdout); system("nosync &"); printf("\n\n"); log_entry( "clock" ); exit(0); }