August 2001

From Illinois Institute of Technology

What's the date?

CHICAGO – Edward M. Reingold, chairman of the Department of Computer Science at Illinois Institute of Technology in Chicago, and Nachum Dershowitz, professor of computer science at Tel Aviv University, have recently put out their second edition of Calendrical Calculations (Cambridge University Press, 2001).

Calendrical Calculations: The Millenium Edition is written as a guide for computer programmers grappling with issues related to dates. It mathematically analyzes 25 calendars (eleven more than are covered in the first edition, Calendrical Calculations, 1997) and provides equations and algorithms that programmers can use when coding for dates.

Programmers often write code for programs that need to do particular things on particular dates, such as send invoices or generate reports. Knowing when holidays and other important days fall is important, but figuring out when these holidays occur can be complicated. Software containing faulty dating code can cause major problems.

According to the New York Times of January 12, 1999, Microsoft Windowsâ 95, 98 and NT got the start of daylight savings time wrong for 2001. The correct date was April 1, but Windows had it starting on April 8. An estimated 40 to 50 million computers were affected, including some in hotels used for wake-up calls. Another notable goof happened when programmers hired by the New York City Taxi and Limousine Commission coded the start date for fare hikes incorrectly because they didn’t realize it was a leap year. The cab company lost 28 days worth of profit from the increased fares.

Reingold and Dershowitz came up with the idea for the first edition of Calendrical Calculations when they ran into problems developing a calendar/diary for a program called GNU Emacs. “Our job was really tough because there was no information on how different calendar systems can be manipulated from a programmer’s point of view,” says Reingold.

Reingold and Dershowitz wrote two papers on some solutions they developed for various calendar systems and immediately received an onslaught of mail from computer scientists asking them for more calendrical algorithms. “It became clear to us that there was keen interest in calendars and programming, and the first book developed as a massive extension of the two papers we wrote, fueled by a fascination for calendars and time-keeping."

The first book was received with much enthusiasm. Danny Hillis, a well-known computer scientist, has been using Calendrical Calculations to help him build a clock that will last for 10,000 years. His clock will tick only once per year. Its century hand will advance once every hundred years, and a cuckoo will come out each millennium. “I have designed the clock so that it displays various calendar systems – Mayan, Moslem, Hindu,” says Hillis. “The book is the best resource I have found to define these complex calendar systems and it provides algorithms that have helped me synchronize the different time-keeping systems in my clock.”

Calendrical Calculations describes 25 calendars and how they relate to one another: the Gregorian (the most commonly used calendar), ISO (International Organization for Standardization), Egyptian (and nearly identical Armenian), Julian (the calendar that was widely used before the Gregorian calendar), Coptic, Ethiopic, Islamic, modern Persian (both astronomical and arithmetic forms), Baha’i, Hebrew, Mayan, Balinese Pawukon, French Revolutionary, Chinese (and nearly identical Japanese), old Hindu (solar and lunisolar), and modern Hindu (solar and lunisolar).

The book comes with a CD that has all the algorithms and calculations the authors devised to help programmers account for dates. A corresponding Web site http://www.calendarists.com gives the date according to all 25 calendars covered in the book.

One of the most interesting stories retold in Calendrical Calculations is that of the Gregorian calendar. The Gregorian calendar was put into effect by Pope Gregory XIII about 400 years ago to replace the Julian calendar, but it wasn’t widely accepted until almost 200 years ago.

The Julian calendar was problematic because it was fast. The winter solstice, marked by the shortest day of the year, usually falls on December 22. Because the Julian calendar was fast, the shortest day of the year would arrive a few minutes earlier each year. After hundreds of years of keeping time with the Julian calendar, the winter solstice fell more than a week early.

In the 16th century, Pope Gregory XIII decided that the problem needed to be addressed. To slow down the calendar, he decreed that only century years divisible by 400 would be considered leap years. Therefore, 1900 was no longer a leap year, but 2000 was. To get the winter solstice back to where it should be (December 22 instead of December 11), he took drastic action and erased 11 days from the calendar. In the year 1582, October 4 was followed by October 15.

The new Gregorian calendar caused massive financial, religious and other disruptions throughout the world. Catholic countries followed the Pope’s decree, but Protestant countries rejected it and continued following the Julian calendar.

Great Britain continued following the Julian calendar for another 200 years. Russia didn’t adopt the Gregorian calendar until 1920. Calendrical Calculations contains algorithms that can process the difference between the Julian and Gregorian calendars, a function that is important for programs that handle historic information.

Edward Reingold has an undergraduate degree in mathematics from Illinois Institute of Technology and a doctorate in computer science from Cornell University. He currently serves as chair of the Department of Computer Science at IIT.

His research interests are in theoretical computer science. He has been a Fellow of the Association for Computing Machinery since 1995. Reingold has authored or co-authored more than 50 papers and has written nine books. In addition to Calendrical Calculations, Reingold is the author and maintainer of the calendar/diary part of GNU Emacs.

Illinois Institute of Technology is a private, Ph.D.-granting university with programs in engineering, science, psychology, architecture, business, design and law. IIT is the home of Armour College of Engineering and Science, the College of Architecture, Institute of Psychology, Center for Law and Financial Markets, Chicago-Kent College of Law, Stuart Graduate School of Business, and the Institute of Design.











This article comes from Science Blog. Copyright © 2004
http://www.scienceblog.com/community

Archives 2001 B