TimeZone
(first writeup) |
(wiki link with corrected names.) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
Because people keep thinking that the "EST" in my `date` command must be incorrect... |
Because people keep thinking that the "EST" in my `date` command must be incorrect... |
||
| − | #!/bin/bash |
+ | Please run the following command (debian styled linux has zdump in /usr/bin/, whilst redhat styled has it in /usr/sbin, whilst under solaris you'll need to change the find search path to /usr/share/lib/zoneinfo (and track down zdump, which I think will be in /usr/sbin, but don't quote me) :) |
| − | function dotz () { |
||
| − | while read i ; do |
||
| − | export TZ=$(echo $i | awk -F' ' '{print $3}') |
||
| − | OFFSET=$(date +%z) |
||
| − | TLA=$(date +%Z) |
||
| − | echo -e "$OFFSET\t$TLA\t$TZ" >> foo |
||
| − | done |
||
| − | } |
||
| − | grep -v "^#" /usr/share/zoneinfo/zone.tab > tz.list |
||
| − | dotz < tz.list |
||
| − | sort -k2 foo > timezones |
||
| − | See results at http://www.cheeky.house.cx/~nemo/extras/timezones |
+ | find /usr/share/zoneinfo -type f | xargs /usr/bin/zdump | grep EST |
| − | First columns is time offset, third column is the $TZ environment variable. The Second column is the time zone identifier, '''incorrectly assumed by most people to be unique'''. I can't find an RFC on it though :( |
+ | Now try it without the grep, and note all the time zone identifiers, ...these are '''incorrectly assumed by most people to be unique'''. I believe (without references) that the timezone acronyms are based on local names - there is no global cooperation in keeping the namespace clean. |
| + | |||
| + | ---- |
||
| + | |||
| + | Further notes: Looks like Aussie EST should properly be named AEST, but usually isn't, and that the namespace is relatively clean: |
||
| + | http://en.wikipedia.org/wiki/List_of_time_zone_abbreviations |
||
Latest revision as of 10:30, 22 September 2010
Because people keep thinking that the "EST" in my `date` command must be incorrect...
Please run the following command (debian styled linux has zdump in /usr/bin/, whilst redhat styled has it in /usr/sbin, whilst under solaris you'll need to change the find search path to /usr/share/lib/zoneinfo (and track down zdump, which I think will be in /usr/sbin, but don't quote me) :)
find /usr/share/zoneinfo -type f | xargs /usr/bin/zdump | grep EST
Now try it without the grep, and note all the time zone identifiers, ...these are incorrectly assumed by most people to be unique. I believe (without references) that the timezone acronyms are based on local names - there is no global cooperation in keeping the namespace clean.
Further notes: Looks like Aussie EST should properly be named AEST, but usually isn't, and that the namespace is relatively clean: http://en.wikipedia.org/wiki/List_of_time_zone_abbreviations