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 4f08fd1083
commit 93804bb479
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/document.h" // rapidjson's DOM-style API
#include "rapidjson/prettywriter.h" // for stringify JSON #include "rapidjson/prettywriter.h" // for stringify JSON
#include <string> #include <string>
#include <chrono>
using namespace BlackMisc::Simulation::Settings; using namespace BlackMisc::Simulation::Settings;
using namespace BlackMisc::Simulation::XPlane; using namespace BlackMisc::Simulation::XPlane;
@@ -111,6 +113,13 @@ namespace BlackMisc
", follow dist m: " + std::to_string(m_followAircraftDistanceM) + ", follow dist m: " + std::to_string(m_followAircraftDistanceM) +
", ts: " + std::to_string(m_msSinceEpochQtFree); ", 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 } // ns
} // ns } // ns

View File

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