A real time clock (RTC) is used to tell the time of day (and sometimes the date) rather than being used to time software actions which do not require synchronism with the Earths rotation.
Typically, they use a a quartz crystal oscillator at 32,768Hz as the timing reference. A quartz crystal has the property of being extremely accurate and stable so the clock should keep good time.
The 32,768 oscillations per second is fed to a chain of binary dividers, each giving one pulse out for two pulses in, so 32,768 becomes 16,384 then 8,192 and so on. After 15 stages of dividing the number reaches 1 pulse per second and that is used as the seconds 'tick'. From the seconds, it's easy to divide by 60 to get minutes, another 60 to get hours, 24 to get days and so on. Inside a RTC you have all these dividers, a method of reading the individual counts back to the rest of the circuit and a method of loading numbers into the counters so you can set the time from another source.
Brian.