-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 10:39 PM To: Sreelal Chandrasenan Subject: Creating timezone files on Solaris
UNIX IN THE ENTERPRISE --- December 04, 2003 Published by ITworld.com -- changing the way you view IT http://www.itworld.com/newsletters ______________________________________________________________________________ Creating timezone files on Solaris By Sandra Henry-Stocker Recently, a reader inquired about the process for defining a timezone on Solaris. Since the timezone that he was interested in setting was not included on the system by default, changing the TZ setting in the /etc/default/init file wasn't going to do the trick. So, before changing the init file or rebooting, we needed to create the Asia/Calcutta file that would be used to define the timezone. The reader asked: "I have been a regular reader of your articles for the past few years and find them really very informative. Now, with respect to your recent article on timezone, I would like to know is there is any way to get my time zone that is IST (Indian standard Time) on Solaris? Currently the Timezone used is an offset of GMT." Where is Asia/Calcutta? Just as the timezone in which I live and work is known both by the names EST (Eastern Standard Time) and "America/New York", the timezone used in India is known both by IST and Asia/Calcutta. It is no big surprise that Calcutta was selected from the many cities in India. Calcutta is one of the largest cities in the world and the capital of its particular region in India (West Bengal). Cities selected to identify their timezones are generally among the most well known in the relevent area. The most interesting thing about the IST timezone is that it is 5.5 hours offset from GMT. IST is one of a very small number of timezones that differ by half an hour instead of an hour from adjacent timezones. Downloading the TZ database The first thing to do if you want to compile a timezone that is not included on your system is to download the TZ database. You can do that with these commands if you have the wget program installed: wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz' gzip -dc tzcode*.tar.gz | tar -xf - gzip -dc tzdata*.tar.gz | tar -xf - The gzip -dc command unzips and extracts the contents of the two files, then extracts the files with the tar -xf- command. Only the tzdata directory is used in this column. The tzcode directory contains, as you might expect, C code for numerous date-related functions. The next thing to do is to move into the tzdata directory and issue the zic command to compile the new particular timezone that you are interested in generating. You will need to this as root because the results of the compilation will be automatically installed in the proper directory -- /usr/share/lib/timezone. # cd tzdata # zic asia Once the new timezone is compiled, you can look in the /usr/share/lib/timezone/Asia (modify the pathname for the particular timezone you are working with) directory and you will notice that many new files have been created. In my case, the list looks like this: Aden Beirut Dubai Karachi Nicosia Samarkand Ulaanbaatar Almaty Bishkek Dushanbe Kashgar Oral Seoul Urumqi Amman Brunei Gaza Katmandu Phnom_Penh Shanghai Vientiane Aqtau Calcutta Harbin Kuala_Lumpur Pontianak Singapore Yerevan Aqtobe Choibalsan Hong_Kong Kuching Pyongyang Taipei Ashgabat Chongqing Hovd Kuwait Qatar Tashkent Baghdad Colombo Jakarta Macau Qyzylorda Tbilisi Bahrain Damascus Jayapura Makassar Rangoon Tehran Baku Dhaka Jerusalem Manila Riyadh Thimphu Bangkok Dili Kabul Muscat Saigon Tokyo All these are small files between 69 and 836 bytes. Indian/Chagos, Indian/Maldives and Europe/Nicosia timezone files were also added in the process of compiling the Asia timezones. Then, to set the system time to use the new timezone, edit the /etc/default/init file, change the TZ line to read TZ=<timezone> (e.g., TZ=Asia/Calcutta) and reboot. Of course, before you do this, you might want to test the new time zone by doing some version of this: boson(~shs) $ date Tue Nov 18 16:47:08 EST 2003 boson(~shs) $ TZ=Asia/Calcutta boson(~shs) $ export TZ boson(~shs) $ date Wed Nov 19 03:17:24 IST 2003 As expected, these times are 10.5 hours apart. This is because I'm on the East Coast of the US (GMT+5) and India's IST time zone is GMT-5.5. This same routine should work for any timezone, although many timezones will already be installed on your Solaris system. My Solaris 7 server was installed with these timezone areas: Australia Brazil Canada Chile Etc Mexico Mideast US Since I have only used Solaris in the US, I have no idea if the OS is installed with different timezone files in other parts of the world. About the author(s) ------------------- Sandra Henry-Stocker has been administering Unix systems for nearly 18 years. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She currently works for TeleCommunication Systems, a wireless communications company, in Annapolis, Maryland, where no one else necessarily shares any of her opinions. She lives with her second family on a small farm on Maryland's Eastern Shore. Send comments and suggestions to mailto:[EMAIL PROTECTED] ________________________________________________________________________________ CUSTOMER SERVICE VIEW YOUR NEWSLETTERS http://reg.itworld.com/servlet/Frs.frs?Script=reg_script_v4&Context=LOGIN UNSUBSCRIBE For instruction on how to unsubscribe, go to: http://www.itworld.com/response/site_support.html#unsubnl CHANGE YOUR E-MAIL ADDRESS To change your e-mail, go to: http://reg.itworld.com/servlet/Frs.frs?Script=change_email_v4&Context=LOGIN For instruction on how to change your e-mail address, go to: http://www.itworld.com/response/site_support.html#email NEWSLETTER ARCHIVES http://www.itworld.com/nl/archive.html NEWSLETTER FAQS For commonly asked newsletter questions, go to: http://www.itworld.com/response/site_support.html ________________________________________________________________________________ CONTACTS * Editorial: Jodie Naze, Director, ITworld.com Site Network, [EMAIL PROTECTED] * Advertising: Clare O'Brien, Vice President of Sales, [EMAIL PROTECTED] ________________________________________________________________________________ PRIVACY POLICY http://www.itworld.com/Privacy/ ITworld.com is a product of: Accela Communications, Inc. 118 Turnpike Road Southborough, MA 01772 USA Copyright 2003 Accela Communications, Inc., All Rights Reserved. http://www.accelacommunications.com ________________________________________________________________________ VISIT OUR SITE NETWORK http://security.itworld.com http://smallbusiness.itworld.com http://storage.itworld.com http://utilitycomputing.itworld.com http://wireless.itworld.com http://www.itworld.com Click here to forward this message to a friend! http://ui.unixinsider.com/GoForward/a14724a91482aSa76228439a25 SUBSCRIBE/UNSUBSCRIBE Please use the link below to modify your subscription, unsubscribe, or change your email address: http://ui.unixinsider.com/Change-Remove/a14724a76228439a25a91482 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]