Pages

Tuesday, August 3, 2010

Script WORLDCLOCK

While looking for a quick reference online to download and have a quick World Clock at the fingertips - even when there is NO connection, I discovered a few tools, some nice, some not so nice... in the end... nothing made the fit to match what I wanted.

So I popped open the command line and put a very basic script together, which in essence repeats the "date" command with different modifiers, and outputs the results to screen.

Sample output:
08/03/10 02:42:52 LOCAL TIME
08/03/10 12:42:52 UTC TIME
08/03/10 02:42:52 HONOLULU TIME
08/03/10 13:42:52 LONDON TIME
08/03/10 05:42:52 LOS ANGELES TIME
08/03/10 16:42:52 MOSCOW TIME
08/03/10 14:42:52 MUNICH TIME
08/03/10 08:42:52 NEW YORK TIME
08/03/10 21:42:52 TOKYO TIME


Apple OS-X Terminal. Paste the following into a new file... you can do this with the following at the command prompt:

pico WORLDCLOCK


Clear
date -j "+%m/%d/%y %H:%M:%S LOCAL TIME"
date -j -u "+%m/%d/%y %H:%M:%S UTC TIME"
date -j -u -v-10H "+%m/%d/%y %H:%M:%S HONOLULU TIME"
date -j -u -v+1H "+%m/%d/%y %H:%M:%S LONDON TIME"
date -j -u -v-7H "+%m/%d/%y %H:%M:%S LOS ANGELES TIME"
date -j -u -v+4H "+%m/%d/%y %H:%M:%S MOSCOW TIME"
date -j -u -v+2H "+%m/%d/%y %H:%M:%S MUNICH TIME"
date -j -u -v-4H "+%m/%d/%y %H:%M:%S NEW YORK TIME"
date -j -u -v+9H "+%m/%d/%y %H:%M:%S TOKYO TIME"


Cntrl-X to Exit and Save.
chmod u+x WORLDCLOCK

this will make the file executable.

Run it from Spotlight by doing a search for WORLDCLOCK, terminal will open and the script will be executed. You can also add an icon on the dock if you so wish.

Things to consider:
- Not yet clear on correct functionality in Daylight Savings time in different time zones. The script will either need to be expanded to take that into consideration, or adjusted to reflect the current time differences.

Have fun & please comment if you have ideas for improvement.

No comments:

Post a Comment