From: Robin Getz Date: Fri, 08 Oct 2004 16:37:30 -0700 Subject: [U-Boot-Users] RTC Question Message-ID: <6.1.1.1.0.20041008161516.01e267c8@wheresmymailserver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: >How could you fix this? As you suggested - just a simple offset (exactly the same will need to go into the Linux kernel). If the overflow occurs - (if you see a date less then 18Sept1974, assume roll over has occurred, add 4 years, 9 months, and 17 days). This will set things to the same day of the week structure as the roll over date (19Sep2058 is a Thursday, and so is 19Sept1974). This also should handle the leap years calculations properly. After this it is a simple matter of just adding 84 years to the return value or display of the function. >U-Boot will probably not even be running when the rollover happens, so it >has zero chance to notice. U-boot may not have to be alive when rollover occurs to have an issue - for a contrived example that has less chance of actually happening than me willing the lotto, if you set U-Boot up to check a network connection monthly for updates, after 2058 it stops checking, because U-boot believes that Oct2058 never occurs. However, by doing the above, all than happens is delaying things until 2087, and then you run into the same problem. But since I plan on being dead by then, I am OK with that. (I'd like to be around in 50 years, but not 80). -Robin