There is a special category of timer known as a real-time clock whose function is to provide an independent time keeper that can provide time measurements in terms of the current time and date as opposed to a counter value. The most popular device is probably the MC146818 and its derivatives and clones that were used in the first IBM PC. These devices are normally driven off a 32 kHz watch crystal and are battery backed-up to maintain the data and time. The battery back-up was done externally with a battery or large capacitor but has also been incorporated into the chip in the case of the versions supplied by Dallas Semiconductor.
These devices can also provide a system tick signal for use by the operating system.
Simulating a real-time clock in software
These can be simulated in software by programming a timer to generate a periodic event and simply using this as a reference and counting the ticks. The clock functions are then created as part of the software. When enough ticks have been received it updates the seconds counter and so on. There are two problems with this: the first concerns the need to reset the clock when the system is turned off and the second concerns the accu-racy which can be quite bad. This approach does save on a special clock chip and is used on VCRs, ovens and many other appliances. This also explains why they need resetting when there has been a power cut!