While looking through the documentation for the "StarTime" software, I found a section that explains that the RTC does not store seconds, and that whenever the software reads from the RTC, it automatically sets the seconds to 30. This means that the Amiga system time can be off by as much as +/- 30 seconds after setting it with the StarTime software. So this got me wondering about what other odd behavior I could find with the Microbotics RTC. For anyone who's interested here's what I found.
- The seconds counter free runs, and is completely unaffected by anything that happens in the RTC chip. Setting the RTC time does not reset its seconds counter to zero. If you want to synchronize the RTC seconds counter with the actual time, then the only way to do this is to disconnect the battery, and then reconnect it at the precise instant when your reference clock shows zero seconds.
- The RTC chip does not store, or even count, the year. The StarTime software uses a trick in which it stores the month and year in the RTC alarm registers for reference. Whenever the software reads from the RTC chip, it checks the month stored in the alarm register against the month counter to see if the year needs to be updated. When it detects that the month counter is less than the stored month, it increments the year, and saves it back into the alarm register. A side effect of this trick can be seen if the machine is left powered off for over a year. When this happens, the battery backed month counter will roll over and count up past the stored month. Now when the StarTime software is run, the month counter is greater than (or equal to) the stored month. The software sees no reason to update the year, and the Amiga system time is now set to one year behind the actual date.
- The alarm register used to store the year is 6 bits wide, and since the software stores the year in BCD, the largest value that this register can hold is 39. This year value represents an offset from the Amiga epoch, Jan 1, 1978, which means that the RTC can only store dates between Jan 1, 1978 and Dec 31, 2017. This is why the StarTime software currently sets the Amiga system time to exactly forty years behind the current date. I've written a small program to address this issue that adds forty years to the Amiga sytem time, and I have it in my Startup-Sequence just after the StarTime command. It works fine, and fortunately I won't have to rewrite it until Jan 1, 2058.
- The RTC chip is aware of, and can handle the day Feb. 29. However, the chip has no means of automatically handling leap years since is doesn't keep track of the year. The scheme that the StarTime software uses to keep track of the year also makes it impossible to automatically adjust for leap years. And so, the date will have to be manually updated once every four years.
- The StarTime software does not automatically adjust for daylight saving time, though there's no technical reason that it couldn't.
https://www.picmicrolab.com/wp-content/ ... CF8573.pdf