September 21, 2004
By Karen Kenworthy
IN THIS ISSUE
What time is it?
It's a popular question, one many of us ask every day. Naturally, the answer depends on when you ask the question. But surprisingly, the answer also depends on who you ask.
For example, ask a rocket scientist, and you might discover the time is "T minus five minutes and counting". A laidback German friend might let us know it's "Dienstag, 21. September 2004". A precise Australian could respond "it's exactly 2:09:48 PM, Tuesday, 21 September 2004".
And of course, your Mother -- who always knows the time -- might say "it's time for supper".
Ask a computer, and you could receive any of those answers. But eavesdrop on conversations between two computers, or listen to a computer talking to itself, and you'll discover our binary buddies speak a special temporal language all their own.
To begin with, computers don't concern themselves with quaint human notions such as years, months, days, hours, minutes or even seconds. Instead, they count tiny intervals of time.
For example, the earliest IBM Personal Computers marked time by counting electrical pulses produced by a special circuit at the astounding rate of 18.2 times per second (once every 55 milliseconds). The count was reset to zero each night at midnight.
Newer PCs also have a timing circuit that oscillates one thousand times a second. This count is set to zero each time Windows starts, or after Windows has run continuously for a total of 4,294,967,295 milliseconds (approximately 49.710269618056 days).
Computers running Windows 95 or later can take advantage of a third circuit to measure time even more accurately. The frequency of this high- speed oscillator varies from one computer to another. But it usually produces a few million pulses each second.
[Nerdy Note: You can discover the exact frequency of your computer's High Resolution Timer. Just run my Computer Profiler program, and click its "Time" tab. Look for the entry labeled "High Resolution Timer Frequency".]
Because this timer ticks so furiously, Windows allocates more space to store its current value. This counter can continue to increase until it's recorded a total of 18,446,744,073,709,551,615 ticks! This should take at least 21,350,398 seconds (assuming a fast 10 MHz oscillator), or a little over 58,454 years, before the counter reaches its limit. They tell me at that point the count is reset to zero and begins again. :)
So, how do our computers manage to turn all these counts into dates and the time-of-day? To perform that trick, they use another circuit, called a Real-Time Clock (RTC), and a little simple arithmetic.
To understand the RTC, let's take a short trip back in time, to the early days of electronic computing. Back to the days when computers were coal- fired colossi, sporting long rows of toggle switches and enormous banks of rapidly flickering lights.
Now a lot of us aren't at our best the first thing in the morning. But these fabulously expensive thinkers were exceptionally dull upon awakening. In fact, when powered up, they did exactly nothing. That's right -- they sat there without a single thought in their hand-wired chassis.
To bring these colossal calculators to consciousness, you began by tying one end of a long rope around the waist of a junior computer operator. The other end was tethered to a heavy immovable object, such as a building support column, or a marketing manager.
The now easily retrievable computer operator was then sent into the cave, err, computer room, armed with a short list of numbers, and a small deck of computer punch cards or a short coil of punched paper tape.
His first job was to enter those numbers into the computer's memory, using rows of toggle switches made just for that purpose. Each toggle switch represented one bit in the computer's memory. Place the switch in one position, and the corresponding bit became a 1. Place the switch in its other position, and the bit magically changed to a 0.
The numbers entered by the operator were computer instructions, codes that ordered the computer to read a single punched card (or read a short length of punched paper tape). That card (or section of tape) contained instructions that ordered the computer to read even more cards (or more tape). This process continued until the operator's supply of cards (or tape) was completely read into the computer's memory.
Now the fun began. The small program now stored in the computer's memory, called a "loader", could read the computer's disk drives. And that's exactly what it did, copying the computer's operating system from a nearby disk into the computer's memory.
Once the operating system took control, it asked the operator a familiar question: What time is it? The operator checked a nearby desk calendar, and entered the current date. Next, after a quick glance at the hands of an old-fashioned clock mounted on the computer room wall, entered the time of day.
From then on, until it once again entered a powered down slumber, the computer knew the current date and time. It simply added the elapsed time, measured by the counters we discussed earlier, to the initial date and time entered by the computer operator.
Did the operator say it was 8 a.m.? Have two hours past since then? The current time must be 10 a.m.!
[Nerdy Note: The numbers, cards or tape were called the "bootstrap" because they allowed the computer to metaphorically "pull itself up by its own bootstraps", or load its own operating system. To this day, the steps required to initialize a computer after powering up are called the "boot process".]
Finally, the ancient computer is fully awake, ready to take its proper place in electronic society, able to juggle data, print reports, and much more!
Today, most of the work of junior computer operators is performed by the computer itself. A short computer program, permanently stored in a special "Boot ROM (Read-Only Memory)" circuit, contains instructions that control a newly awakened computer. This little program reads a special "boot sector" from the computer's hard disk, and copies the sector's data to the computer's memory.
The instructions stored in the boot sector compel the computer to load more data from the disk, eventually leading to the loading of Windows, or another computer operating system.
What happens next? It depends on the age of your PC. The oldest personal computers behaved just like their mainframe ancestors, asking a human operator for the current date and time.
But early in the evolution of small computers, these baby brains acquired a Real Time Clock (RTC) circuit. This gadget is a close cousin of the simple alarm clock that probably sits on the nightstand beside your bed. It lacks the colorful LED display, and doesn't have a snooze button. But, once set, it does keep track of the current time of day. As a bonus, it also knows the current date.
Now, instead of asking a human operator "What time is it?", that question is directed to the RTC. The question is asked only once. As before, the current time is computed by simple arithmetic. The time that has elapsed since that question was asked and answered is simply added to the initial date and time. The result is "now", the current date and time.
Now you may be wondering, why do computers with an RTC bother keeping their own counts of times past? Why not completely rely on the RTC, whenever the computer needs to know the current date and time?
There are two reasons. First, our computer's RTC circuits speak very slowly. Each digit of the date and time must be requested and retrieved separately. And each response can take several milliseconds to arrive -- an eternity in the high-speed world of computers.
Second, the Real Time Clocks found in most personal computers are notoriously inaccurate. Many gain or lose several seconds per day. What's worse, their inaccuracy is not consistent. The chip's precision depends on the temperature inside the computer's case, the age of the circuit, and the health of the battery that powers the RTC when the computer is powered down.
OK, now you may be wondering, why do most computers rely on their RTC at all? Probably, it's force of habit. It's easy for the writers of operating systems, such as Windows, to depend on a circuit that's always present, despite its drawbacks.
But there is an alternative. Today, more and more computers periodically synchronize their sense of time with an ultra-precise atomic clock. All they need is an Internet connection, and a program like my new Time Sync.
Ironically, we're out of time. :)
But before we get together again, you can give Karen's Time Sync a try. Just visit the program's home page at:
To download a copy of Karen's Computer Profiler, drop by its home page at:
As always, both programs are free for personal/home use. If you're a programmer, you can download their Visual Basic source code too!
Better yet, get the latest version of every Power Tool, including Time Sync and Computer Profiler, on a brand-new, shiny CD. You'll also get three bonus Power Tools, not available anywhere else. Source code of every Power Tool, the text of every issue of my newsletter, and some of my articles written for Windows Magazine, are also included. And owning the CD grants you a special license to use all my Power Tools at work.
Best of all, buying a CD is the easiest way to support the KarenWare.com web site, Karen's Power Tools, and this newsletter! To find out more, visit:
Until we meet again, if you need to know the time, just ask. And if you see me on the 'net, be sure to wave and say "Hi!"
Power Tools Newsletter
- Please don't click SPAM.
- Windows-Key Searching
- Disabling Web Search
- Karen's Directory Printer v5.4.3 Released
33088 Verified Subscribers
Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.Click here to Subscribe