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.

7 replies on “How To Add GMT To the World Clock Dashboard Widget”

I couldn’t get this to work in 10.9.3. I could edit (with TextEdit) and save the file (authenticating with Admin rights) but invoking the clock widget resulted in a blank clock (no hands, no time zone, no numbers). When I replaced the edited file with the original file, the clock worked normally again. Hmmm…

Works fine in OS X 10.9.4.

Patrick – Make sure you don’t have any additional commas where they shouldn’t be (e.g. at line endings where it’s the last object in an array).

I had the same problem and found a comma that was breaking the JS formatting.

This exact code worked for me on 10.10


var UTC = [
{city:'UTC', offset:0, timezone:'Etc/Zulu', id:"3372000"}
];

Remember to add the UTC variable to the continents array as shown in the article.

Leave a Reply

Your email address will not be published. Required fields are marked *