From: robertlipe Date: Sat, 20 Jul 2013 02:41:38 +0000 (+0000) Subject: Get rid of explicit usec refs in destinator, waypt, and unicsv. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~496 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=66af192efc718d48ec9282c2cba1981c00a4e87a;p=gpsbabel.git Get rid of explicit usec refs in destinator, waypt, and unicsv. --- diff --git a/gpsbabel/destinator.cc b/gpsbabel/destinator.cc index d35ac0c1a..67c0c0e9e 100644 --- a/gpsbabel/destinator.cc +++ b/gpsbabel/destinator.cc @@ -334,8 +334,6 @@ destinator_read_trk(void) strptime(buff, "%d%m%y%H%M%S", &tm); int millisecs = (int) time % 1000; wpt->SetCreationTime(mkgmtime(&tm), millisecs); -// FIXME: this is papering over a problem somewhere... -wpt->microseconds = millisecs * 1000; if (wpt->fix > 0) { wpt->fix = (fix_type)(wpt->fix + 1); diff --git a/gpsbabel/unicsv.cc b/gpsbabel/unicsv.cc index f1d8c0e14..fbc71311f 100644 --- a/gpsbabel/unicsv.cc +++ b/gpsbabel/unicsv.cc @@ -1761,15 +1761,15 @@ unicsv_waypt_disp_cb(const waypoint *wpt) } snprintf(buf, sizeof(buf), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec); - if (wpt->microseconds > 0) { - int len = 6; - int ms = wpt->microseconds; + int millisecs = wpt->GetCreationTime().msec(); + if (millisecs > 0) { + int len = 3; - while (len && (ms % 10 == 0)) { - ms /= 10; + while (len && (millisecs % 10 == 0)) { + millisecs /= 10; len--; } - snprintf(msec, sizeof(msec), ".%0*d", len, ms); + snprintf(msec, sizeof(msec), ".%0*d", len, millisecs); strcat(buf, msec); } gbfprintf(fout, "%s%s", unicsv_fieldsep, buf); diff --git a/gpsbabel/waypt.cc b/gpsbabel/waypt.cc index dbb7ea686..eb35939c9 100644 --- a/gpsbabel/waypt.cc +++ b/gpsbabel/waypt.cc @@ -538,7 +538,8 @@ waypt_time(const waypoint *wpt) if (wpt->creation_time <= 0) { return (double) 0; } else { - return ((double)wpt->creation_time + ((double)wpt->microseconds / 1000000)); + + return ((double)wpt->creation_time + ((double)wpt->creation_time.msec() / 1000)); } }