It counts clock cycles which are generated by an oscillator . Usually Quartz oscillators are used but you could even hook up a mechanical pendulum to a computer . A common oscillator frequency for Real Time Clocks is 32 . 768 kHz . Divide this frequency by 215 easy with a 15 bit counter and you get one tick per second . Real Time Clocks are often powered by a small battery which keeps them running even if the computer is otherwise shut down . Quartz Oscillators are highly accurate even cheap ones have 10 or 20 parts per million accuracy , so for every second the error is less than 50 ns . The accuracy depends on temperature and a stable supply voltage though . <| sep |> My yellow lab had both of his ACL surgeries here , they took great care of him and he loves going there because all the treats he gets !