RaspberryPi is a great budget computer. To keep the cost of the unit down, there is no real time clock. This is usually taken care of by the software: the operating system gets the accurate date-time automatically from one of the time servers.
When a RaspberryPi is kept offline but accurate time keeping is needed, an RTC is required. I needed one for Theodora's music box
, as I wanted it to play a Happy Birthday tune on her birthday. To do this, I added an RTC module from Adafruit.
I got this unit from Oomlout.co.uk. It's a simple kit, which only takes a few minutes to solder together. Read the adafruit instructions carefully. Note that the resistors are not required for the RPi.
Using the unit in linux is surprisingly straight forward. You can basically read and write the time to this unit from the command line.
The battery should last for at least 10 years!