2. What are Time Zones?Time Zones are a geophysical world globe division of 15o each, starting at Greenwich, in England, created to help people know what time is it now in another part of the world. Nowadays it is much more a political division than geophysical, because sometimes people needs to have the same time as other people in not-so-far locations. And for energy savings reasons, we have today the Daylight Savings Time, that are also a Time Zone variation. Time Zones are usually defined by your country government or some astronomical institute, and is represented by 3 or 4 letters. See Section 2.2 for examples. If you want to know what time is it now in a different world region, you can use the timezoneconverter.com website. 2.1. Daylight Savings TimeFor energy savings reasons, governments created the Daylight Savings Time. Our clocks are forwarded one hour, and this makes our days look longer. In fact, what really happens is only a Time Zone change. The primitive time (UTC) is still, and will allways be, the same. Later we'll see how to enable and disable DST automatically in Linux. 2.2. Time Zones ExamplesThere is nothing better than examples: Table 1. Brazilian Time Zones. Shifts relative to UTC
Please send me contributions like this table for US Time Zone. 2.3. Time Zone Mechanism on LinuxLinux systems uses the GLIBC dynamic Time Zones, based on /etc/localtime. This file is a link to (or a copy of) a zone information file, usually located under /usr/share/zoneinfo directory. From a geophysical perspective, there is only 360o/15o=24 Time Zones in the world. But to make things easy to people, and to accommodate all the political variations (like Daylight Savings Time), you'll find hundreds of zoneinfo files in /usr/share/zoneinfo, each for every world city, country, etc, and its not complete (it can never be). Some countries, like Brazil, don't have a fixed day to start Daylight Savings Time. It is defined every year, a couple of months before summer, and you may end up in a situation you'll have to change your zoneinfo file, which was compiled by zic from a text file like this. Example 1. Brazilian Zone Info text file
The Rule block defines the date and time we change the Time Zone, while in the Zone block we reference the Rule will manage it. Note that the Zone name is actually the file name under /usr/share/zoneinfo directory, and here we defined several different names for the same Time Zone, just to be easyer for people to find their zone. This file's comments explains how to install these time zones, using the zic zoneinfo compiler (which already installs them also). To make it effective, you only have to link (or copy) the zoneinfo file to /etc/localtime. In some distributions, there is a higher level (and preferred) way to set the Time Zone, described in Section 3.1. After making /etc/localtime pointing to the correct zoneinfo file, you are already under that zone rules and DST changes are automatic -- you don't have to change time manually. The following commands sequence shows Linux Time Zone mechanics dynamism. Note they were all issued in less than one minute:
At 20:13, I was in my default brazilian Time Zone (BRST), then I switched to GMT and my system time changed to 23:13! When your Time Zone enters DST, you'll see a similar effect, but the rules are all inside your Time Zone (/etc/localtime link doesn't change like this example). An application running in this machine (eg. web-server generating access logs) will feel this change, so it is very important for developers to remember that the full Time Concept is the current time plus current Time Zone, as described in Section 1. In the end, I switched back to my correct Time Zone. Linux HOWTO full list |
|
This document, LDP HOWTO-INDEX, is copyrighted (c) 1995 - 2002 by Tim Bynum, Guylhem Aznar, Joshua Drake and Greg Ferguson. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html. If you have questions, please contact the LDP.
Web Design Copyright © 1999-2003. Chrisranjana Software Solutions Pvt Ltd. syndicate rss feed |