There isn't a clock as such in a computer, there's a timer. The clock software uses the timer to 'tick' on from a starting point which either you type in or is obtained from a time server. If some other piece of software makes excessive use of the timer, the clock can lose time. I know this because my old DOS software used the timer to do time outs on network requests, and under certain conditions it could overload the timer.
I have an old BBC Master computer which I dug out of the loft a few months ago - when first booted and even after replacing the batteries it lost time for the first month or so but now its accurate after being left powered up for a long time. I wonder how many computers bought today will still work in 30 years time?
Gaining time is a bit more unusual, but as suggested above your clock may have been reset by a time server elsewhere, especially if it gained all the time in one bite, as it were.