Saturday, 10 March 2007

F-22 Raptor DST bug?

Perhaps not a DST bug, but a time processing bug non the less...

According to the Official Air Force website the F-22 Rapture was delayed in deployment to Kadena.

While en route to Kadena Air Base, Japan, Feb. 10, a software issue affecting the F-22 Raptor's navigation system was discovered.

The Air Force website did not go into more details than that, however CNN Analyst Don Sheppard did,

It is stealthy. It's fast and you want it all to go right on your first deployment to the Pacific and it didn't. At the international date line, whoops, all systems dumped and when I say all systems, I mean all systems, their navigation, part of their communications, their fuel systems... they could have been in real trouble.... they tried to reset their systems, couldn't get them reset. This could have been real serious. It certainly could have been real serious if the weather had been bad. It turned out OK. It was fixed in 48 hours. It was a computer glitch in the millions of lines of code, somebody made an error in a couple lines of the code and everything goes.

Gee, what could cause a software program to crash while crossing the international dateline? Perhaps a time of day processing function?

Let me see if I can reproduce such a bug...


#include "time.h"
#include "assert.h"

static time_t last_update = 0;
const time_t now = ::time(0);
double dif = ::difftime( now, last_update );

assert(dif >= 0.0);

// refresh 'status' every minute
if ( 59 < diff) {
last_update = now;
// do more useful things...
}

This code assumes that at some point in time while crossing the IDL the F-22 received a clock resync (perhaps from a ground station in Japan?). The code above would cause the system to abort, while crossing the IDL from west to east. I'll leave the reverse case as an exercise to the reader.

As we all prepare for the DST bug to hit our email servers, blackberries, and other systems... be thankful we are not flying in an F-22 Raptor.

No comments:

Post a Comment