Ref T709, virtual function for timestamp setting

This commit is contained in:
Klaus Basan
2019-07-27 20:25:08 +02:00
committed by Mat Sutcliffe
parent 1440c4d2e9
commit 04e57df5f7
2 changed files with 15 additions and 0 deletions

View File

@@ -11,7 +11,9 @@
#include "rapidjson/document.h" // rapidjson's DOM-style API
#include "rapidjson/prettywriter.h" // for stringify JSON
#include <string>
#include <chrono>
using namespace BlackMisc::Simulation::Settings;
using namespace BlackMisc::Simulation::XPlane;
@@ -111,6 +113,13 @@ namespace BlackMisc
", follow dist m: " + std::to_string(m_followAircraftDistanceM) +
", ts: " + std::to_string(m_msSinceEpochQtFree);
}
void CXSwiftBusSettingsQtFree::setCurrentUtcTime()
{
using namespace std::chrono;
const milliseconds ms = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
m_msSinceEpochQtFree = static_cast<int64_t>(ms.count());
}
} // ns
} // ns
} // ns

View File

@@ -27,6 +27,9 @@ namespace BlackMisc
//! Constructor.
CXSwiftBusSettingsQtFree();
//! Dtor
virtual ~CXSwiftBusSettingsQtFree() {}
//! DBus server
const std::string &getDBusServerAddress() const { return m_dBusServerAddress; }
@@ -66,6 +69,9 @@ namespace BlackMisc
//! Convert to string
std::string convertToString() const;
//! Sets timestamp to now
virtual void setCurrentUtcTime();
protected:
//! The JSON members @{
static constexpr char JsonDBusServerAddress[] = "dbusserveradress";