From: robertlipe Date: Tue, 20 Jan 2015 02:39:51 +0000 (+0000) Subject: Eliminate use of strptime in cst. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~10^2~61 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1a25f43420fdd11be37048dc28932a726e9c150f;p=gpsbabel.git Eliminate use of strptime in cst. --- diff --git a/gpsbabel/cst.cc b/gpsbabel/cst.cc index e307db2a7..04d4b3cc8 100644 --- a/gpsbabel/cst.cc +++ b/gpsbabel/cst.cc @@ -22,7 +22,6 @@ #include "defs.h" #include "cet_util.h" -#include "strptime.h" #include #include @@ -248,7 +247,6 @@ cst_data_read(void) } else { int interp, i; char name[256]; - char* pow; if (data_lines < 0) { if ((2 != sscanf(cin, "%d %128s", &i, name)) || @@ -284,14 +282,13 @@ cst_data_read(void) wpt->shortname = QString::fromLatin1(((char*)&name) + 5); } - pow = strrchr(cin, '^'); - if (pow != NULL) { - struct tm tm; - - pow = lrtrim(++pow); - strptime(pow, "%Y %m %d %H:%M:%S", &tm); - - wpt->SetCreationTime(mkgmtime(&tm)); + QString time_string(cin); + int caret = time_string.indexOf('^'); + if (caret > -1) { + QString dts = time_string.mid(caret + 1).trimmed(); + QDateTime dt = QDateTime::fromString(dts, "yyyy MM dd hh:mm:ss"); + dt.setTimeSpec(Qt::UTC); + wpt->SetCreationTime(dt); } wpt->latitude /= 100000.0; wpt->longitude /= 100000.0; diff --git a/gpsbabel/parse.cc b/gpsbabel/parse.cc index 9003a9c86..6540b94b5 100644 --- a/gpsbabel/parse.cc +++ b/gpsbabel/parse.cc @@ -22,7 +22,6 @@ #include "defs.h" #include "jeeps/gpsmath.h" -#include "strptime.h" #include #include #include //strtod