From bd710b03677b742d4b0cf952fa932c09bf7595ba Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Sun, 29 Dec 2019 16:01:11 -0500 Subject: [PATCH 1/2] use a more machine readable timestamp format --- navmon.cc | 4 ++-- navparse.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/navmon.cc b/navmon.cc index 001e77c..e2c077f 100644 --- a/navmon.cc +++ b/navmon.cc @@ -136,7 +136,7 @@ std::string humanTime(time_t t) } char buffer[80]; - strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S %z", &tm); + strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S %z", &tm); // strftime(buffer, sizeof(buffer), "%F %T ", &tm); return buffer; } @@ -147,7 +147,7 @@ std::string humanTime(time_t t, uint32_t nanoseconds) gmtime_r(&t, &tm); char buffer[80]; - std::string fmt = "%a, %d %b %Y %H:%M:"+fmt::sprintf("%07.04f", tm.tm_sec + nanoseconds/1000000000.0) +" %z"; + std::string fmt = "%Y-%m-%d %H:%M:"+fmt::sprintf("%07.04f", tm.tm_sec + nanoseconds/1000000000.0) +" %z"; strftime(buffer, sizeof(buffer), fmt.c_str(), &tm); return buffer; diff --git a/navparse.cc b/navparse.cc index a6e535f..e38fdde 100644 --- a/navparse.cc +++ b/navparse.cc @@ -480,7 +480,7 @@ std::string humanTime(int gnssid, int wn, int tow) gmtime_r(&t, &tm); char buffer[80]; - strftime(buffer, sizeof(buffer), "%a, %d %b %Y %T %z", &tm); + strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S %z", &tm); return buffer; } char getGNSSChar(int id) From 361233292c7ea66f76014ff8fc2ccc69b718264c Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Sun, 29 Dec 2019 16:04:36 -0500 Subject: [PATCH 2/2] navdump: omit commas to make it easier to extract values with awk For example, to extract the ECEF XYZ coordinates: awk '/ECEF/{print $9, $10, $11}' --- navdump.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/navdump.cc b/navdump.cc index 989a378..8d86ef2 100644 --- a/navdump.cc +++ b/navdump.cc @@ -631,8 +631,8 @@ try etstamp(); auto latlonh = ecefToWGS84(nmm.op().x(), nmm.op().y(), nmm.op().z()); - cout<(latlonh)/M_PI + cout<(latlonh)/M_PI <<" lat "<< 180*std::get<0>(latlonh)/M_PI <<" elev "<< std::get<2>(latlonh) << " acc "<