Quote:
Originally Posted by blackhole54
I have not unravelled all of the mysteries of how linux deals with time zones, but I believe the date command is taking its time zone info from /etc/localtime independent of the value of TZ. You can find the time in a different zone using the zdump command with the time zone file as its argument. For example, to find out what time it is in Denver, type:
zdump /usr/share/zoneinfo/America/Denver
|
blackhole54 - I didn't know about the zdump command - thanks a lot, I had wondered if there was a mechanism to do this. It turns out you can omit the /usr/share/zoneinfo/ if you like.
Quote:
Originally Posted by blackhole54
If you are going to do this a lot, this is something that would easily lend itself to simple scripting to save yourself some typing.
(I am on a public winXP computer and am doing this from memory, so I may have made an error in the path in my example. If so, adjust accordingly.)
|
Your memory is fine.
noir911, you could define an alias and put it in your .bashrc. I assume there is a some standard list of locations for which you wish to show the time. For example:
Code:
$ alias show_my_times='zdump Singapore Europe/Moscow Europe/London US/Eastern'
$ show_my_times
Singapore Tue Nov 7 20:42:49 2006 SGT
Europe/Moscow Tue Nov 7 15:42:49 2006 MSK
Europe/London Tue Nov 7 12:42:49 2006 GMT
US/Eastern Tue Nov 7 07:42:49 2006 EST
To find the names of the timezones, you can do something like this:
Code:
$ find /usr/share/zoneinfo -type f |grep -i singapore |xargs zdump |cut -c21-
Asia/Singapore Tue Nov 7 20:45:05 2006 SGT
posix/Asia/Singapore Tue Nov 7 20:45:05 2006 SGT
posix/Singapore Tue Nov 7 20:45:05 2006 SGT
right/Asia/Singapore Tue Nov 7 20:44:42 2006 SGT
right/Singapore Tue Nov 7 20:44:42 2006 SGT
Singapore Tue Nov 7 20:45:05 2006 SGT
As you can see there are many different definitions for Singapore. Just choose the one you want.