The release date for this computer was in January of 2010. I suspect that age has had an effect on at least your CMOS battery, this is what keeps the computer time. It's time to replace the battery. Being a desktop this is comparatively easy to change out, it cost between $4. and $5. depending where you purchase it.
HP has posted instructions for replacing the CMOS battery. With the images provided in the instructions it's easy to follow. This must be done with the computer turn off.
When you open the case touch the metal of the case to discharge any static-electricity that may be in your body. A electrostatic discharge as small as 10V can kill integrated circuits, like the chips on the RAM module/s.
There is an image in the instructions of the CMOS battery where a torx driver is pressed against the release clip of the battery housing. This clip needs to be pushed away from the battery to release it. Important!: Look at the surface of the battery as it rests in its socket and take note of the polarity, this battery is usually facing positive (+) side up. The new battery must be installed facing the same way.
After the battery is installed restart the computer. Press the Windows key and the R key to open the Run box.
When the Run box opens type in control, then click/tap on OK. This will open the Control Panel.
Click/tap on Date and time, select Change Date and time, change the Date first, then the time to the current am or pm time. After the date and time has been reset click/tap of Apply, then [/b]OK[/b]. If this doesn't hold you will need to reset the date and time in the BIOS.
At seven years old this computer is reaching the point where components will begin to breakdown, a good example are the electrolytic capacitors found in the motherboard and PSU. The electrolytics start breaking down which will effect the computer's ability to maintain a consistent voltage. I don't mean to appear as the voice of doom, I just believe you should be aware that computers don't live forever.