/* DT.c: Reads the date and time of RTC peer second and print it on the monitor (user can set the date and time). Compiler: BC++ 3.1, Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) MSC 6.0, MSVC 1.52. Compile mode: Large Project: DT.c ..\Lib\(7188XAL.Lib,7188XBL.Lib,7188XCL.Lib or 7188EL.Lib) Hardware: 7188E [07/Dec/2006] by Liam [July,13,2011] by Nicholas */ #include "..\lib\7188e.h" /* you must change this lib to suit the hardware that you want to use. */ void main(void) { int year,month,day,hour,min,sec; int oyear,omonth,oday,ohour,omin,osec; int quit=0; oyear=omonth=oday=ohour=omin=osec=-1; Print("Start dt.exe\r\n"); while(!quit) { if(Kbhit()) { switch(Getch()) { case 'q': quit=1; break; case 'd': /* set date to 02/29/2000 */ SetDate(2000, 2, 29); break; case 't': SetTime(23, 59, 0); break; case 'y': /* set date to 02/28/2000 */ SetDate(2000, 2, 28); SetTime(23, 59, 0); break; } } GetDate(&year,&month,&day); GetTime(&hour,&min,&sec); if(oyear!=year||omonth!=month||oday!=day||ohour!=hour||omin!=min ||osec!=sec) { oyear=year; omonth=month; oday=day; ohour=hour; omin=min; osec=sec; Print("Date=%02d/%02d/%04d Time=%02d:%02d:%02d\n\r",month,day,year,hour,min,sec); } } }