Ivars Peterson's MathTrek

July 21, 1997

# A Glitch in Time

On June 30, time stood still for one second. Clocks stopped and an additional second was added to the day. This adjustment was needed to bring the official time into agreement with Earth's ever-so-slowly decreasing rotation rate. It was the 21st leap second since the first one was added on June 30, 1972.

This tiny adjustment is just one more place where computers can go wrong in keeping time and dealing with the vagaries of the calendar. By now, everyone has probably heard about the problems that may arise when the year 2000 arrives. Any computer system that stores or handles fewer than the full four digits of the year will have to deal with a year number that is smaller than its predecessor. Subtractions to determine the time interval will yield negative numbers, with unexpected and potentially disastrous consequences.

Problems involving dates and time go beyond the unfortunate use of two-digit years. Indeed, synchronizing human time with computer time presents programmers with a host of difficulties. Although computers hum to a precisely defined, inflexible rhythm that sets the pace of games, database queries, and calculations, they must also function in the context of a calendar plagued with the quirkiness and arbitrariness of human experience and thought -- 60-second minutes, 60-minute hours, 24-hour days, switches between standard time and daylight saving time, 7-day weeks, months of varying length, and leap-day and leap-second corrections to bring the calendar into accord with celestial and terrestrial time.

From a computer programmer's point of view, such quaint conventions are at best a nuisance and at worst a nightmare. Every four years, for example, computers of all sorts fail because unwary software developers forgot that February has 29 rather than 28 days. In 1992, for example, legions of ATM machines neglected to acknowledge the extra day and ended up scrambling the data encoded on cards of customers who used an ATM on February 29. Inevitably, new leap-year problems surfaced in 1996, and more such bugs will undoubtedly add to the confusion in the year 2000.

Even the occasional insertion of a leap second can pose serious difficulties, as happened on New Year's Day in 1996.

The AP Radio division of the Associated Press in Washington, D.C., operates a highly automated system for ensuring that news reports and other features are broadcast at the right times to the right places throughout the world. It relies on highly accurate clocks supplied by the Leitch company to keep everything on time. Several times a day, these clocks automatically call up equipment at the U.S. Naval Observatory to check the date and synchronize the time. The Department of the Navy, with its master clock facility at the observatory, serves as the country's official timekeeper.

Soon after midnight, during the very early hours of New Year's Day, 1996, AP Radio engineer Phil Avner was notified that the wrong broadcasts were being sent to some parts of the radio network. Moreover, a Windows program running on a desktop computer had compared its clock to the "official" time and had mysteriously shut down because of a conflict it apparently couldn't resolve.

When he arrived at the facility, Avner joined in the effort to check the system to see what the trouble might be. "You start from one end and keep going, trying to eliminate possibilities," Avner says. At some point, he looked at the official date and suddenly realized that it said Jan. 2. That couldn't be right, he thought. "I've just come in from a New Year's Eve party!"

Prompted by that clue, Avner and his crew traced the problem to the Leitch clocks and manually turned the clocks back to Jan. 1. Initially unwilling to believe that the Naval Observatory could be supplying wrong information, Avner telephoned the observatory. There was no answer. "Getting anyone at 3 A.M. on New Year's Day is tough," Avner says. As a temporary measure, the AP engineers reprogrammed the clocks so they couldn't dial out to the Naval Observatory.

What had gone wrong? It turns out that when a leap second was added at midnight, the official clock, in effect, read 11:59:60. At the same time, the date was incremented to Jan. 1. However, because of a computer error, when the time went to 0:00:00, the date was incremented again, becoming Jan. 2. New Year's Day had lasted all of 1 second!

Of course, it happened on a Monday, when the AP Radio broadcast schedule is somewhat different than it is on the other days of the workweek. For the computers operating the system, however, it was Tuesday morning.

"On nearly any other day of the week, this [glitch] would not have been such a big ordeal for us," Avner says. "The Tuesday morning schedule is just different enough to really mess things up."

I never could find out precisely why the problem had occurred and who was responsible for it. Apparently, there had been previous leap-second glitches, and solutions were available. Whatever the cause, however, a little leap second had made its mark in more ways than intended.

### References:

Peterson, Ivars. 1996. Fatal Defect: Chasing Killer Computer Bugs. New York: Vintage.

Suplee, Curt. 1997. Astrophysics: Wobbly Earth gets second helping. Washington Post (June 30).

The U.S. Naval Observatory Directorate of Time has a website at http://tycho.usno.navy.mil/time.html. You can also find out the exact time at http://time.nist.gov:13/.