Categories
Posts

How To Add GMT To the World Clock Dashboard Widget

Having co-workers around the globe means that we often use GMT to refer to a date & time. I turned to the Word Clock widget (for Dashboard in Mac OS X) in hopes of showing GMT in an easy reference area. Unfortunately GMT is not one of the available timezones in the drop down list.

The easiest way to show the right time is to select a city in GMT that doesn’t change for summer time. Reykjavík, Iceland in the Atlantic region is the option I see most people recommend. But I wanted the the label on the clock to read GMT as well. This turned out to be really easy to do.

First step, open /Library/Widgets/World Clock.wdgt/WorldClock.js in your favorite editor (as root).

Near the top of the file you’ll see the region arrays defined. I added a new one:

[sourcecode lang=”javascript”]
var GMT = [
{ city: ‘GMT’, offset: 0, timezone: ‘GMT’ },
];
[/sourcecode]

Next you need to add it to the list of regions (around line 238), which looks like:

[sourcecode lang=”javascript”]
var continents = [
{name:"GMT", array:GMT},
{name:"Africa", array:Africa},
{name:"Asia", array:Asia},
{name:"Atlantic", array:Atlantic},
{name:"Australia", array:Australia},
{name:"Europe", array:Europe},
{name:"North America", array:NorthAmerica},
{name:"Pacific", array:Pacific},
{name:"South America", array:SouthAmerica}
];
[/sourcecode]

Save the file and exit the editor. As your regular user account run killall Dock, which will restart the process that manages the Dashboard.

Now go into the Dashboard and add a World Clock widget. You’ll see GMT as one of the region options:

In the new GMT region there is only one city:

Giving you a World Clock widget that shows GMT and is labeled as such:

This worked for me on Mac OS 10.6.8. I expect it to be the same for 10.7 but I haven’t tried it.