What aratti is proposing with two low forward drop diodes (preferably one of the Schotkky diodes like a BAT42) is commonly called "or'ing the power sources" and is frequently used for battery backup applications similar to what you are doing.
For example, here is a crude schematic for or'ing a 5v supply with a 3v lithium battery to provide power to a RTC. However, make sure that you don't have any pull-up resistors connected to the 3v supply or it will drain the backup battery even when the 5v is present...something I learned from experience recently ;>) Your RTC normally requires pull-ups on some of its pins....so make sure they are connected to the 5V and not to the 3v....RTC will continue to keep time without the pull-ups when running on the 3v backup.
5v----------- -|>----
..........................|
...........................-------------- RTC power supply pin
..........................|
3v lithium ----|>---
Bookmarks