/////////////////////////////////////////////////////////////////////////////// // File: y2ktest.cs // // Contents: // A sample script that checks three behaviors: // 1. How TinyTERM handles the year change from 1999 to 2000; // 2. How TinyTERM handles the date changes from 28 Feb 2000 to 1 Mar 2000 // 3. How TinyTERM handles filedates before and after the year 2000 // // To properly test, the operating system should be installed before 2000, // and the system clock should be in the year 2000 or beyond. // // This script also demonstrates passing of variables to functions. // // Originated by P. Clark, Century Software 2/23/99 /////////////////////////////////////////////////////////////////////////////// te.cls(); te.displaynl("Y2K Test Script"); te.displaynl("TinyTERM 4.03 and above"); te.displaynl(""); te.display("The current date is "); te.displaynl(cdate(time())); te.display("The current time is "); te.displaynl(ctime(time())); // starts at 11:55 p.m. on 31 Dec 1999 and keeps counting until 12:05 a.m. // watch the accompanying date msgbox("Click OK to start 1999-2000 rollover test.","Test One",0); start = atod("12/31/1999.23:55:00"); finish = "00:05:00"; TimeTest(finish,start); // starts at 11:55 p.m. on 28 Feb 2000 and keeps counting until March // watch for 29 February to appear te.displaynl(""); msgbox("Rollover test complete. Click OK to start leap year test.","Test Two",0); start = atod("02/28/2000.23:55:00"); finish = "03/01"; TimeTest(finish,start); // creates a file with the current system date // displays the date and time stamps for that file and C:\autoexec.bat te.displaynl(""); msgbox("Leap year test complete. Click OK to start file date test.","Test Three",0); if (!isdir("c:\\temp")) { mkdir("c:\\temp"); } full = "c:\\temp\\testdate.txt"; oldfile = "c:\\autoexec.bat"; fcreate(1,full); fwrite(1,"This is the first line of text.\r\n",-1); fwrite(1,"This is the last line of text.\r\n",-1); fclose(1); d1 = filedate(full); d2 = filedate(oldfile); te.displaynl(""); DateFile(full,d1); DateFile(oldfile,d2); te.displaynl(""); msgbox("Year 2000 testing completed.","Done",0); // minute-by-minute counting function // used for both year 2000 rollover and 2000 leap year testing function TimeTest(TestString,StartTime) { loop = 0; now = "Not yet"; while (pos(TestString,now,1)==0) { clicks = StartTime + loop; te.display(_str(clicks)); te.display(" "); te.display(cdate(clicks)); te.display(" "); te.displaynl(ctime(clicks)); now = cdate(clicks) + ctime(clicks); loop = loop + 60; } } // check and display the date/time stamp on a file function DateFile(FileName,FileTime) { day = cdate(FileTime); hour = ctime(FileTime); te.display("File "); te.display(FileName); te.display(" created on "); te.display(day); te.display(" at "); te.displaynl(hour); }