The Flight Tracker dashboard widget that comes with Mac OS X 10.4 (Tiger) seems to have a fairly major bug. However, this bug seems to be the result of something quite obscure to do with timezones, and it only seems to manifest itself in the UK during the summer.
I've noticed this problem a few times: specifically whenever any one of my close friends or family members flies anywhere. This time, my mother is on her way back from San Diego to Bristol via Newark. Thanks to the incredibly annoying terrorist attack attempt today, my dad and I were understandably concerned about flight delays, so I pulled up the Flight Tracker. Unfortunately, the information seems completely wrong.
Turns out, the minutes are right but the hours don't relate to any of the relevant timezones.
Anyway, a little background. Here in the UK, we have two main time scenarios: firstly GMT, which is for all intents and purposes, UTC. We also use BST: "British Summer Time" which is UTC+1h, and kicks in for archaic agrarian reasons and the "Think of the children!" brigade who are convinced it'll stop traffic accidents.
While the rest of OS X seems okay and correctly uses BST, Apple's Mail.app has always strangely listed incoming mail as being sent relative to "BDT", which comes out as "British Daylight Time", which is fairly meaningless as there's no such thing. The times are correct, but they just have the wrong abbreviation afterwards. On researching it, this seems to be the result of bad data from the Unicode people which might have made its way into NSDate. Anyway, it's usually just a cosmetic thing, and of little or no consequence.
I believe, however, that it's the cause of the Flight Tracker widget's problems. To test this, I altered the widget to display the timezone, by replacing the bit in FlightTracker.js, in function formatDateForDisplay() that says
var timeStr = date.toLocaleTimeString("short");
var timeStr = date.toLocaleTimeString("long");
Looking a bit deeper into FlightTracker.js, I'm not really surprised there's a problem. The timezone calculation code is fairly messy, with comments such as:
// We're going to be stupid and hard coded about parsing the server provided date strings for now // ??? for some reason parseInt returns 0 on this but parsefloat works ???
// here we do proper handling of the timezone offsets. // We enter everything in pretending it's UTC time // and then we convert it to miliseconds since 1970, // add the timezone offset in miliseconds to it // and then set this as the new UTC time
There seems to be some string hacking going on at several places to decode the data sent from FlyteComm. The original data is reasonably well structured, with the timezone offsets being given correctly as -0700 and +0100, which presumably indicate that the times are given as local times of the departure/arrival locations, as per normal for the airline industry.
I'm not completely sure what's going on, as I'm not really set up to debug someone else's widget, especially one with weird custom controls, and barely any code comments. It's obvious to me that the widget isn't particularly well written, and is one of those things that "just works". It was probably hacked up for fun by a Dashboard developer, and then fasttracked to the nearest Steve Jobs keynote rehearsal. As Steve Jobs's Dashboard demos tend to be done at MWSF and WWDC, I doubt this problem has ever really been seen at Apple. I bet if it was a problem with Pacific Daylight Time being misinterpreted, it'd be fixed immediately! I've done a little bit of googling, and it looks like the BDT bug has already been submitted to Apple (several times), and it's still there.
When I get a chance, I may try to debug this one further, and perhaps rewrite FlightTracker's timezone code properly using the correct offsets rather than performing nasty magic using getLocaleTimeString().
What I would prefer is that the timezone of each time is given next to the time. Ideally, they should toggle-on-click or slowly fade between local times (to the flight) and local times to the machine, and possibly relative times ("1 hour ago", "in 53 minutes", etc.) That would make the tool a lot more intuitive anyway. I'd rather not reinvent the whole widget, as in all other ways, the widget's really not too bad.
UPDATE: I've logged this with Apple as bug #4676024.