Byte.com: How Linux tells and uses timeFeb 07, 2000, 16:26 (1 Talkback[s])
(Other stories by Moshe Bar)
[ Thanks to Moshe Bar for this link. ]
"This month, as we continue our Kernel Internals series, we dig a bit deeper into hardware issues. One of the most important things to keep track of (not just for computers, but for humans as well) is time. This fits nicely with the recent Y2K hype. Let's see how Linux keeps its time."
"The system's awareness of time and dates is a software abstraction. At the lowest levels in the hardware, computers maintain hardware counters (usually registers) for interval timing (counting processor clock ticks), along with larger hardware register spaces to store detailed date information (i.e., year, month, day, hour, minute, second). This lets the system maintain a consistent date across reboots. Some software functions in the OS simply use the interval counter, along with a known starting point, and convert the tick count into something that has meaning to mere mortals and relevant computer software...."
"The clock and timer facilities are used by the kernel for general housekeeping chores, which need to be done at regular intervals. The kernel sets up the computer clock (hardware) to generate a clock interrupt at regular intervals. An interrupt handler is entered with every clock interrupt, and this handler code does interval processing for the kernel (we'll take a closer look at this in a moment). The kernel can also use the hardware clock for real-time profiling or other time- and interval-related functions. Linux provides command-line and programming interfaces to timer and date functions, including, of course, the basic date(1) command, which sets or retrieves the kernel's notion of what the date and time it is."