/* This is a test program to read in the time */ #include #include main() { int i,j; char c; struct tm *cmostime; time_t *rawtime; time(&rawtime); cmostime = (struct tm*) gmtime(&rawtime); printf("Year: %d \n",cmostime->tm_year); cts10_write( (int) 0x1B); cts10_write( (int) 0x17); cts10_write( (int) cmostime->tm_year / 10); cts10_write( (int) (cmostime->tm_year % 10)); /* for(j=20; j>1; j--) { */ while(1) { for (i=1; i<10; i++) cts10_flush(); cts10_write( (int) 0x1B); cts10_write( (int) 0x13); /* The null command - to force into command state */ cts10_flush(); cts10_write( (int) 0x1B); cts10_write( (int) 0x07); cts10_write( (int) 0x00); cts10_read(); /* Disable interpt requesta */ for (i=1; i<100; i++) cts10_flush(); cts10_write( (int) 0x1B); cts10_write( (int) 0x05); cts10_write( (int) 0x00); cts10_read(); /* Set IRQ interval to zero */ for (i=1; i<100; i++) cts10_flush(); cts10_write( (int) 0x1B); /* Capture buffer read */ cts10_write( (int) 0x01); cts10_read(); printf(">>"); for (i=1; i<300; i++) cts10_flush(); cts10_write((int) 0x1B); /* escape character lead in to command */ cts10_write((int) 0x02); /* Ask for formatted time and date */ while ( NULL != (c = cts10_read() ) ) { printf("%c",c); } printf("<<\n "); fflush(stdout); sleep(1); } exit(0); }