Apple ProDOS Date And Time Stamper
Peter J. McLoone
Don't have a clock card, but want to time stamp your files? This program is just what you need. ProDOS is required.
Like many Apple II users, I don't have a clock card for my Apple, but I'd like to be able to time stamp my files. And since I usually boot my system several times in a session, I'd appreciate being able to set the date only once, and have some way for the computer to remember what it was when I reboot. Even better, when I boot the system a day or two later, I'd like to be able to use the previous date and time information and change only what needs to be changed—usually the day of the month and the time. "Date and Time Stamper" solves these problems with a short easy-to-use program you can customize for your own particular needs.
Since Date and Time Stamper is written entirely in BASIC, simply type it in, save a copy to disk, and type RUN. When you run the program for the first time, it prompts you for the values for month, day, year, hour, and minute. You enter these values as five numbers separated by slashes (/). You must enter legitimate values for all five fields.
The time-of-day values are based on a 24-hour clock—that is, 00:00 through 23:59. If you're primarily interested in the date, you may want to set the time of day to midnight by entering zeros. For example, 11/5/87/0/0 sets the date to November 5, 1987 and the time of day to midnight. Likewise, 11/5/87/15/38 sets the time of day to 3:38 p.m. The values you enter become the defaults.
When you run the program and it finds a default date, it displays the date, provides instructions on how to change it, and prompts you for any changes. Pressing RETURN will keep the defaults. You may keep as many of the defaults as you like by using slashes as a place holder. For example: ///16/15 keeps the defaults for the month, day, and year while setting the time of day to 16:15 (4:15 p.m.). If you type /6 followed by RETURN, the day of the month is changed to 6 and the defaults will be used for the other values.
How It Works
The program works by examining the MODIFIED field in the ProDOS catalog entry for the file identified by the variable FI$. If it has a date, the program uses it to determine default values. If it doesn't, then the program prompts you to enter all five fields. Once you provide a legitimate set of values, the program sets the appropriate locations in memory so ProDOS will start using it, and then saves itself to a file named FI$, putting the new date into the MODIFIED field in its ProDOS catalog entry. If you don't change any fields, it sets the appropriate memory locations and stops.
One way to use Date and Time Stamper is in your startup routine. You may want to add the following statement to the end of your START-UP file:
This will run the program automatically when you boot. Another possibility is to make Date and Time Stamper itself your STARTUP program. Anything you'd like to do at startup can be placed into the program in lines 100 to 1999. You must also change the value of FI$ in line 10:
The program assumes the startup drive is device 1 in slot 6 (the usual) and searches the main directory on that volume for FI$. Line 60 needs changing if your startup device location is different. The program also sets the screen to 80 columns. Delete line 50 if your Apple doesn't have this capability. You'll also want to revamp the print statements in lines 3600-3835 and 5100-5300 to provide a more pleasing output with a 40-column display.
Date and Time Stamp has a simplified check for leap year that won't fail until 2100, so it shouldn't present a problem. If you're still using your Apple II in the year 2000, however, the year check in line 26200 can be modified.
Date and Time Stamper
For instructions on entering this program, please refer to "COMPUTE!'s Guide to Typing In Programs" elsewhere in this issue.