Bumbling news sites display incorrect Baghdad time

Written by Adrian Holovaty on April 4, 2003

A number of major news organizations' sites around the world have latched onto a peculiar trend: Displaying the current time in Baghdad.


I won't comment on the usefulness of such a feature (I can see both arguments), but I will comment on the several incorrect techniques many sites have been using to display Baghdad time.

Problem #1: Relying on users' computers to provide accurate time

Here's an example: Visit the Los Angeles Times' home page in a graphical browser with JavaScript turned on, and you'll see a "Baghdad Time & Weather" sidebar in the right rail. It updates every second, making it look like a real clock.

Pretty cool, eh? I can practically see the men in suits patting themselves on the back, saying, "Man, this is great. We're really taking advantage of the medium."

Except...no. The clock may add a certain gee-whiz factor, but for many users, the information is inaccurate. The reason: It grabs the current time from your computer's operating system and calculates the time in Baghdad by adding (in the Times' case) 4 hours.

That means, if you set your system's clock to 8 a.m., latimes.com will dutifully report it's noon in Baghdad. And if you set it to noon, the clock will read "4 p.m." It's kind of fun to play with, once you figure it out.

How many users' system clocks are inaccurate? I don't know. Is Baghdad time critical information? No. But it's still a possible inaccuracy, and news organizations should strive to weed out inaccuracy (as the Los Angeles Times itself has done recently in another arena).

It comes down to this: As I said in a similar article last August, relying on client-side information to produce content that aims to be journalistically sound is a bad idea. Plus, relying on user-provided data on the Web is insecure and just plain naïve, in general. That's one of the hallmark rules of Web programming.

Problem #2: Relying on JavaScript

With JavaScript turned off, the headline "Baghdad Time & Weather" is a lie; the time simply isn't shown. The Times and its content-sharing partners could avoid this problem by placing a server-generated timestamp in a noscript tag: an adequate replacement.

Problem #3: Incorrect information, period

Take a look at the Orlando Sentinel's Baghdad clock (right side of page), the nbc-2.com clock and the aforementioned latimes.com clock. At time of this writing, Orlando is reporting it's 8:20 a.m. in Baghdad. NBC2 is reporting it's 7:20. Los Angeles is reporting it's 9:20.

How could that be? I don't know. Are those sites each assuming I live within their respective time zones, and calculating Baghdad time relatively, based on that incorrect assumption? Possibly. If you can figure it out, please share.

The best practice

The best solution, in my mind, is practiced by the New York Times. Its clock is generated by the server, not by JavaScript. Which means the site's reported time will stay unchanged until the page is refreshed -- but that's a small price to pay for accurate information.


Posted by Lenny on April 4, 2003, at 1:56 a.m.:

Couldn't they take the server side time and use it to start a javascript function that counts up like a clock, using a static one in the <noscript> as well? Best of both worlds, I would think.

Posted by Adrian on April 4, 2003, at 2:09 a.m.:

Yeah, that'd be a great way of doing it, too. I touched on that (in painstaking detail) in a previous article.

Posted by Nathan Ashby-Kuhlman on April 4, 2003, at 4:01 a.m.:

One problem that you haven't mentioned, Adrian: Baghdad happens to be on daylight saving time at the moment, which means that, until Sunday at 2 a.m. when we switch to daylight time too, Baghdad is nine hours ahead of U.S. eastern time, not eight hours as it was a few days ago. The Orlando Sentinel's clock, for example, still only seems to be adding 8 hours, so that could be another reason for the discrepancies you report.

The pot oughtn't to call the kettle black, though; my clock (which had to be done in JavaScript, unfortunately, but does use server time and does completely hide itself if scripting is off) was wrong for a while earlier today too.

Also, do we really need to know the time in Baghdad to the second? Having the clock update all the time is as visually distracting as a bad banner ad. I'd prefer a subtle clock that would update itself every minute, but not every second.

Posted by Gary on April 4, 2003, at 4:06 a.m.:

Adrian, the reason why some sites might be displaying the wrong time, is Iraq's funky daylight savings time. Iraq changed their clocks on April 1, while most countries wait until the first Sunday....throwing off the nice and easy javascript clocks...unless of course, a staffer was around at midnight April 1 and plans on hanging out around 2am Sunday.

Posted by jim winstead on April 4, 2003, at 12:22 p.m.:

actually, all of europe changes to dst on the last sunday in march. the united states is one of the oddballs, here. here's a good list of when different countries switch to/from daylight savings.

Posted by Rex Sorgatz on April 4, 2003, at 7:37 p.m.:

After an extremely slow applet with this functionality showed up on one of our sites, I screamed at work for the first time in over a year! Then someone else made a replacement javascript clock using client time. Argh, two screams in one day! I had to quickly build a replacement. The one I made (example here) uses server time written out with javascript (similar, I see, to the example you gave here.)

Technical matters aside, believe it or not, there has been a lot of confusion about when Iraq actually observes daylight savings. CNN reported the observation as April 1, while AP declared it April 3, and there have been other mixed dates, including those mentioned on miscellaneous websites (one editor sent me the webexhibits.org link as "proof" and I sent back four contrary examples of "proof"). Anyway, my suspicion is that as with many other countries (like, um, Indiana), daylight saving is somewhat loosely regarded. That's part of the problem, I think.

Posted by Adrian on April 5, 2003, at 6:23 p.m.:

Thanks, everybody, for the heads-up about daylight savings time. So they didn't just get the programming wrong; they got the facts wrong.

Posted by Dean on April 7, 2003, at 4:29 p.m.:

Okay, why is there any need for "Iraqi Time" when the average person browsing the Web (or watching TV or reading the paper) in the U.S. knows that Iraq time is 9 hours ahead of wherever in the heck they are?! I mean come on, these people (including myself) are not idiots. There's only 24 hours in a day. This is a meaningless feature...why don't they go ahead and put a site counter up on page along with "This site was updated April 4, 2003!"

Posted by Tom Gilder on April 10, 2003, at 8:25 p.m.:

Heh, a few months ago I came across a pizza delivery site in New York that actually used the client computer's clock to see whether the shop was open for deliveries. So if a user happened to have the wrong time set, or maybe be in the wrong timezone, they wouldn't be able to order. Idiotic.

Comments have been turned off for this page.