Bug 31202

Summary: RTC: alarm time and day wrong
Product: Timers Reporter: Joerg Riechardt (J.Riechardt)
Component: Realtime ClockAssignee: timers_realtime-clock
Status: CLOSED CODE_FIX    
Severity: normal CC: florian, john.stultz, maciej.rutecki, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.38 Tree: Mainline
Regression: Yes
Bug Depends on:    
Bug Blocks: 27352    

Description Joerg Riechardt 2011-03-16 13:26:04 UTC
I have a VDR PC used for tv recording, so it has to wake up by BIOS.
To check if the next startup time is set properly after manual start, I use cat /proc/driver/rtc.
Since 2.6.38 this is not working any more. It does not show the startup time set in the BIOS, but is (re)set to 00:00:00 1970-01-01.
Comment 1 john stultz 2011-03-18 19:02:24 UTC
Joerg: Mind checking that with the following patch the issue is resolved?
http://git.kernel.org/?p=linux/kernel/git/tip/linux-2.6-tip.git;a=patch;h=f44f7f96a20af16f6f12e1c995576d6becf5f57b
Comment 2 Joerg Riechardt 2011-03-18 19:43:23 UTC
Yes, with that patch it works again. Thanks a lot!
Comment 4 john stultz 2011-03-18 20:16:59 UTC
(In reply to comment #2)
> Yes, with that patch it works again. Thanks a lot!

Joerg: Great to hear! Thanks for validating the patch!

Just as a heads up though: In the future, there may be multiple RTC alarms queued by the kernel, so after a reboot only the earliest event will persist.

Further, there are many cases where the RTC alarm state doesn't correctly persist across reboots. 

Thus, applications should not rely upon RTC alarm persistence across reboots, and should instead check the RTC and make sure it is set to the appropriate time (using persistent storage on disk) on startup.

As mentioned in the patch log, we do try to preserve the old behavior where possible, but applications expecting persistent alarms across reboots will either run into trouble on some hardware, or run into trouble when there are multiplexed alarms.
Comment 5 Rafael J. Wysocki 2011-03-27 19:49:23 UTC
Fixed by commit f44f7f96a20af16f6f12e1c995576d6becf5f57b .