If you find your computer keeps losing the correct time, then it's likely that the CMOS battery has failed. This is a small ‘wristwatch-style’ flat battery inside the computer that regulates the date and time, among other things.
These are cheap to buy (around £5) and are easy to replace in a desktop PC (it’s slightly more fiddly with a laptop).
You can buy one of these batteries in many places, including online or even larger supermarkets.
How to replace a CMOS battery
Switch off your PC and unplug it from the mains. Open your computer carefully using a small screwdriver. If possible, wear an anti-static wristband while handling your PC, to avoid damaging the circuitry with static.
Look for the CMOS battery inside the motherboard - it's a small silver disc battery that should be easy to remove.
Replace the CMOS battery with your new one, screw the laptop or desktop chassis back on, and you’ll be able to log back in and start up as usual.