From 04e57df5f7387e1a51cd9a8dc73f6611a1e3ff58 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 27 Jul 2019 20:25:08 +0200 Subject: [PATCH] Ref T709, virtual function for timestamp setting --- .../simulation/settings/xswiftbussettingsqtfree.cpp | 9 +++++++++ .../simulation/settings/xswiftbussettingsqtfree.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.cpp b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.cpp index 3376992a9..2e2d7e550 100644 --- a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.cpp +++ b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.cpp @@ -11,7 +11,9 @@ #include "rapidjson/document.h" // rapidjson's DOM-style API #include "rapidjson/prettywriter.h" // for stringify JSON + #include +#include 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(system_clock::now().time_since_epoch()); + m_msSinceEpochQtFree = static_cast(ms.count()); + } } // ns } // ns } // ns diff --git a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h index 6564415aa..a2b321fdd 100644 --- a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h +++ b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h @@ -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";