If you are taking part in projects that involve people from around world, you tend to have to pay attention to what time it is for the other dude or gal...

I was always able to tell what time it was in New York, for example. Well, roughly... Glorified guesswork at best. As I'm spending more and more time in emacs these days, I thought: "Hell, has no emacs user had this problem before?"

Turns out someone had. There is `time.el', which ships with emacs. And it features a world time clock out of the box. The default list of Cities is a little short, so I took half an hour to come up with a slightly more elaborate list:

(setq display-time-world-list
      '(("US/Hawaii" "Hawaii")
        ("America/Los_Angeles" "Los Angeles")
        ("America/Denver" "Denver")
        ("America/Winnipeg" "Winnipeg")
        ("America/New_York" "New York")
        ("America/Caracas" "Caracas")
        ("America/Manaus" "Manaus")
        ("America/Buenos_Aires" "Buenos Aires")
        ("America/Sao_Paulo" "São Paulo")
        ("Africa/Dakar" "Dakar")
        ("UTC" "UTC")
        ("Europe/London" "London")
        ("Europe/Berlin" "Berlin")
        ("Europe/Helsinki" "Helsinki")
        ("Europe/Istanbul" "Istanbul")
        ("Africa/Cairo" "Cairo")
        ("Asia/Baghdad" "Baghdad")
        ("Europe/Moscow" "Moscow")
        ("Asia/Tehran" "Tehran")
        ("Asia/Kolkata" "New Dehli")
        ("Asia/Novosibirsk" "Novosibirsk")
        ("Asia/Irkutsk" "Irkutsk")
        ("Asia/Hong_Kong" "Hong Kong")
        ("Asia/Shanghai" "Beijing")
        ("Australia/Perth" "Perth")
        ("Asia/Seoul" "Seoul")
        ("Asia/Yakutsk" "Yakutsk")
        ("Asia/Vladivostok" "Vladivostok")
        ("Asia/Tokyo" "Tokyo")
        ("Australia/Adelaide" "Adelaide")
        ("Australia/Melbourne" "Melbourne")
        ("Pacific/Auckland" "Auckland")))

(setq display-time-world-time-format
      "%R %5Z (UTC%z) - %d %3h - %A")

(global-set-key (kbd "<f8>") 'display-time-world)

Now, when I hit `F1' I get a new buffer that displays the current time all around the world (the list only misses a few time zones):

world-time

Yes, I know. Awesome, right? ;)

Posted Thu 28 Jun 2012 13:28:24 CEST Tags: