1
0
Fork 0

Patch from Ron Jensen: make the TTW computation marginally less silly.

This commit is contained in:
jmt 2009-01-03 17:58:01 +00:00 committed by Tim Moore
parent 2b0ffae339
commit 0b9e224be9

View file

@ -485,14 +485,9 @@ GPS::updateTTWNode(UpdateContext& ctx, double distance_m, SGPropertyNode_ptr nod
unsigned int TTW_minutes = 0; unsigned int TTW_minutes = 0;
unsigned int TTW_hours = 0; unsigned int TTW_hours = 0;
char TTW_str[9]; char TTW_str[9];
while (TTW_seconds >= 3600) { TTW_hours = TTW_seconds / 3600;
TTW_seconds -= 3600; TTW_minutes = (TTW_seconds / 60) % 60;
TTW_hours++; TTW_seconds = TTW_seconds % 60;
}
while (TTW_seconds >= 60) {
TTW_seconds -= 60;
TTW_minutes++;
}
snprintf(TTW_str, 9, "%02d:%02d:%02d", snprintf(TTW_str, 9, "%02d:%02d:%02d",
TTW_hours, TTW_minutes, TTW_seconds); TTW_hours, TTW_minutes, TTW_seconds);
node->setStringValue(TTW_str); node->setStringValue(TTW_str);