/* cktime * * displays the present date and time from both the time-of-day (TOD) and * the battery-backed (RTC) clocks on the UNIXPC. * * Thad Floryan, 2-Feb-1989 Small changes by Peter Mauzey, January 13, 2000 */ #include #include #include #include #include char *mth_name[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; char *day_name[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; main() { struct rtc rval; time_t tval; time(&tval); syslocal(SYSL_RDRTC, &rval); /* read RTC */ printf("TOD: %sRTC: %s %s %2d %02d:%02d:%02d %04d\n", ctime(&tval), day_name[rval.wkday], mth_name[(rval.mon10 * 10) + rval.mon1 - 1], (rval.day10 * 10) + rval.day1, (rval.hr10 * 10) + rval.hr1, (rval.min10 * 10) + rval.min1, (rval.sec10 * 10) + rval.sec1, (rval.yr10 * 10) + rval.yr1 + 1900); }