Harley Hahn's Guide to
|
A Personal Note
Chapters...
Command
INSTRUCTOR |
Appendix F... Time Zones and 24-Hour Time Unix and the Internet are used around the world, and times must be expressed carefully, especially within the headers of email messages and Usenet articles. In general, both Unix and the Internet use a 24-hour clock. For example, within the header of an email message, you might see 20:50 instead of 8:50 PM. If you are not used to a 24-hour clock, use the conversion information below.
Conversion between the 24-hour time system
(midnight) 12:00 AM = 00:00 12:00 PM = 12:00 (noon)
Whenever your programs need to know the time, date, or time zone, they get the information from settings that are maintained by Unix. For example, when you send a mail message, your mail program puts the date, time, and time zone on the message. To ensure that the time and date are always correct, most Unix systems use a program to synchronize the computer's clock with an exact time source on the Internet. This program runs in the background, checking the time and date automatically at regular intervals, and making corrections as necessary(*). Although the time checking is automatic, you do need to make sure your time zone is set correctly. Normally, this is done when you install Unix. * Footnote Time-checking is carried out using a system called NTP or Network Time Protocol. The purpose of NTP is to synchronize computer clocks with a reference clock. The reference clock can be on the same network or on the Internet. The program that does the work is ntpd, a daemon that runs in the background. Some systems use a program called ntpdate, which is not a daemon. ntpd does a better job at time synchronization and, eventually, it will replace ntpdate. For this reason, the use of ntpdate is deprecated. Similarly, an older program called rdate is also deprecated in favor of ntpd. In practice, you will see time-zone information expressed in three different ways. First, when you see a specific time, you may also see an abbreviation for the local time zone. For example, here is the output from a date command (see Chapter 8) that shows a time of 8:50 PM, Pacific Daylight Time (PDT):
$ date
Another way you might see this same information is with the time converted to UTC (Coordinated Universal Time), also referred to as GMT (Greenwich Mean Time) or UT (Universal Time)(*). In case you are not familiar with UTC, I explain it below. * Footnote There are technical differences between UTC, GMT and UT. However, for practical purposes, you can consider them the same. UTC is considered to be a universal time. It is expected that everyone who uses the Internet should be able to translate UTC times into his or her own local time. If you are not sure how to do this, the tables in Figures F-1 and F-2 will help you. You will often see UTC/GMT/UT times in an email message or Usenet article, even when the message or article did not originate in the UTC time zone. The conversion is done automatically by the software. As an example, here is the same time as the one above specified as UTC. To display the current time in this format, use date with the -u option:
$ date -u
Notice how, in this example, the UTC time is 3:50 AM, one day later. This is because UTC is 7 hours ahead of PDT. For reference, Figure F-1 summarizes the time zones used in the U.S. and how they compare to UTC. Figure F-2 does the same for the European and Indian time zones. One last way in which you may see time specified is as a local time followed by the difference in hours from UTC. Here is an example taken from an email header. The format is a bit different from that of the date command. Date: Sun, 21 Dec 2008 20:50:17 -0700 This header line shows the same time, 8:50 PM, and indicates that the local time zone is -7 hours different from UTC. Figure F-1: U.S. time zones
Figure F-2: European and Indian time zones
Once you understand how time zones differ from UTC, you can use the tables in Figures F-1 and F-2 to convert local times and calculate time zone differences. Here are some examples. You live in New York and it is summer. You get an email message with the time 17:55 UTC. What is this in your local time? In the summer, New York uses EDT (Eastern Daylight Time). Checking with the tables, you see the difference between UTC and EDT is -4 hours. Thus, 17:55 UTC is 13:55 EDT, or 1:55 PM New York time. You live in California and you have a friend in Germany. How many hours is he ahead of you? Assume it is winter. California uses PST (Pacific Standard Time), and Germany uses CET (Central European Time). From the tables, the difference between UTC and PST is -8 hours. The difference between UTC and CET is +1 hours. Thus, your friend is 9 hours ahead of you. In the summer, PST changes to PDT, and CET changes to CEST. However, the difference between the two time zones does not change, and your friend is still 9 hours ahead of you. You work at a technically advanced Internet company on the U.S. West coast. You are the manager of the Foobar department, and you have to arrange a weekly telephone meeting with the programmers, who work in Bangalore, India, and the Vice President of Information Confusion, who works in New York. What is the best time to have the meeting? To start, let's assume it is winter. The U.S. West Coast uses PST, New York uses EST, and India uses IST (India Standard Time). According to the tables, the difference between PST and UTC is -8 hours. The difference between EST and UTC is -5 hours. The difference between IST and UTC is +5.5 hours. This means that India is 10.5 hours ahead of New York and 13.5 hours ahead of the U.S. West Coast. For example, midnight on the West Coast is 1:30 PM in India. Let's say that you can induce the programmers to come in early and talk to you at 7:30 AM their time. In New York, it will be 9:00 PM the previous day. On the West Coast, it will be 6:00 PM the previous day. This is a good fit, so you set up your weekly meeting at 6:00 PM Monday on the West Coast, 9:00 PM Monday in New York, and 7:30 AM Tuesday morning in India. In the summer, PST moves ahead 1 hour to PDT, and EST moves ahead one hour to EDT. Indian time doesn't change. Looking at the tables and recalculating, we see that, during the summer, India is only 9.5 hours ahead of New York and 12.5 hours ahead of the West Coast. Thus, if you keep the same times for the West Coast and New York, the programmers don't have to show up until 8:30 AM, which lets them sleep in for an extra hour. What's in a Name? UTC, UT, GMT Greenwich (pronounced "Gren-itch"), a borough of London, was the home of the Royal Observatory from 1675-1985. It was at this observatory that our modern system of timekeeping and longitude was developed. For this reason, the imaginary north- south line that runs through the observatory is designated as 0 degrees longitude. In 1884, the time at Greenwich was adopted as the global standard used to determine all the time zones around the world. This global standard time is called Greenwich Mean Time or GMT. (In this context, the word "mean" refers to average.) GMT is used widely on the Internet, and is sometimes referred to by the newer, more official name of UT (Universal Time). In addition to UT, you will see another name, UTC (Coordinated Universal Time). UTC is the official value of Universal Time as calculated by the U.S. National Bureau of Standards and the U.S. Naval Observatory. You might wonder why the abbreviation for Coordinated Universal Time is UTC, not CUT. UTC was adopted as an official international standard in 1970. The work was done by a group of experts within the International Telecommunication Union. When it came time to name the new standard, the group had a problem. In English, the abbreviation for Coordinated Universal Time would be CUT. But in French, the name is Temps Universel Coordonné, and the abbreviation would be TUC. The group of experts wanted the same abbreviation to be used everywhere, but they couldn't agree on whether it should be CUT or TUC. The compromise was to use UTC. Although the abbreviation is inexact in both English and French, it had the enormous advantage of keeping the peace. (Not too many people know this, but now you do.)
List of Chapters + Appendixes
© All contents Copyright 2024, Harley Hahn
|