diff --git a/sensors/offline/FileReader.h b/sensors/offline/FileReader.h index 7d8a912..6a7e90d 100644 --- a/sensors/offline/FileReader.h +++ b/sensors/offline/FileReader.h @@ -71,6 +71,8 @@ namespace Offline { static constexpr char sep = ';'; + bool convertNanoSecondTimestamps = true; // otherwise use milliseconds + public: /** empty ctor. call open() */ @@ -83,6 +85,13 @@ namespace Offline { open(file); } + /** ctor with filename */ + FileReader(const std::string& file, bool convertNanoSecondTimestamps) + : convertNanoSecondTimestamps(convertNanoSecondTimestamps) + { + open(file); + } + /** open the given file */ void open(const std::string& file) { clear(); @@ -192,6 +201,12 @@ namespace Offline { sline >> delim; sline >> data; // might be "" if there is no data + if (convertNanoSecondTimestamps) + { + ts /= 1000000; + } + + if (idx == (int)Sensor::WIFI) {parseWiFi(ts, data);} else if (idx == (int)Sensor::BEACON) {parseBeacons(ts, data);} else if (idx == (int)Sensor::GROUND_TRUTH) {parseGroundTruth(ts, data);}