Added option to read data with nanosecond timestamps
This commit is contained in:
@@ -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);}
|
||||
|
||||
Reference in New Issue
Block a user