Every personal computer contains two clocks: a built-in hardware clock and a virtual clock. The hardware clock (real-time clock) runs whether the system is on or off. The virtual clock (system clock) is set to the real-time clock when the computer is turned on and exists only while the computer is operating. While the computer is up and running, the two clocks run independent of each other.
The system clock is a 24-hour timer and has no real concept of days, whereas the real-time clock tracks the time and date. In fact, the system clock has no concept of traditional hours, minutes, and seconds. It merely increments a counter 18.2 times per second. The operating system, which is dependent upon the system clock for the time, converts the counter into hours, minutes and seconds.
As for the date, the operating system reads the real-time clock via the BIOS during initialization, then tracks the date independently based on the virtual-system clock rolling over midnight.