Usually a computer is equipped with two clocks. A CMOS clock which can be set in the setup-menu of the particular computer system and an operating system or kernel based clock. The CMOS clock is queried during system boot and is used to set the operating system clock during the boot phase. Afterwards the kernel will usually not refer any more to the CMOS clock. In Windows systems, setting the clock in Windows will set both clocks.
The CMOS clock is the one you see when you boot your computer into its setup configuration, usually done by entering a special key press at boot up. The kernel clock is the one displayed in the system tray that can be set when you double click on it.
While the computer is running, the CMOS clock and the kernel based system clock will drift apart. There are many reasons for this starting with fabrication based inaccurateness of quartz crystals and ending with exhausted motherboard batteries. In current computers, this is generally a small, common Lithium non-rechargeable 3 volt #CR3032 battery that will normally outlast the computer. In older computers, this battery could be any number of different types, some rechargeable and some not. This small battery is not to be confused with the larger main battery used in laptops.
In times past, there were attempts to use very accurate clocks in computers. One popular one was called the "Dallas" clock which boasted an accuracy of 2 to 3 seconds per year. Obviously, this accuracy was not cheap to produce. So, in an effort to reduce the overall cost of computers, and with the advent of Windows and the Internet to allow checking and setting the clocks, the much cheaper use of crystals is now used almost exclusively. Crystals can be very accurate, but here again, accuracy costs so many are not. Compare this to watches, which also use crystals. A $4000 Rolex keeps very accurate time, a $5 Wal-mart one may not.
