public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] RTC Question
@ 2004-10-08 16:27 Robin Getz
  2004-10-08 18:17 ` Wolfgang Denk
  2004-10-08 19:49 ` Victor Wren
  0 siblings, 2 replies; 6+ messages in thread
From: Robin Getz @ 2004-10-08 16:27 UTC (permalink / raw)
  To: u-boot

All:

General question, in the specific processor (Blackfin BF533) that I am 
using, the on-board RTC can have a 32768 days, and defaults to starting at 
01Jan1970. This means that RTC rollover will occur around Fri, 19-Sep-2059 
11:59pm. On Sat 20-Sep-2059, the date will be displayed as Thur 01-Jan-1970.

Should I add extra complexity, to extend things past this?

I see issues in other code that will roll over around 19Jan2038, so I would 
expect that others are not concerned about it?

-Robin

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [U-Boot-Users] RTC Question
@ 2004-10-08 23:37 Robin Getz
  0 siblings, 0 replies; 6+ messages in thread
From: Robin Getz @ 2004-10-08 23:37 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-10-08 23:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-08 16:27 [U-Boot-Users] RTC Question Robin Getz
2004-10-08 18:17 ` Wolfgang Denk
2004-10-08 21:55   ` Frank
2004-10-08 22:10     ` Wolfgang Denk
2004-10-08 19:49 ` Victor Wren
  -- strict thread matches above, loose matches on Subject: below --
2004-10-08 23:37 Robin Getz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox