summaryrefslogtreecommitdiffhomepage
path: root/opentrack-logic
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack-logic')
-rw-r--r--opentrack-logic/tracklogger.cpp14
-rw-r--r--opentrack-logic/tracklogger.hpp6
2 files changed, 19 insertions, 1 deletions
diff --git a/opentrack-logic/tracklogger.cpp b/opentrack-logic/tracklogger.cpp
index c644df16..64dda579 100644
--- a/opentrack-logic/tracklogger.cpp
+++ b/opentrack-logic/tracklogger.cpp
@@ -3,6 +3,17 @@
TrackLogger::~TrackLogger() {}
+void TrackLogger::reset_dt()
+{
+ t.start();
+}
+
+void TrackLogger::write_dt()
+{
+ const double dt = t.elapsed_seconds();
+ write(&dt, 1);
+}
+
void TrackLoggerCSV::handle_first_col_sep()
{
if (!first_col)
@@ -32,4 +43,5 @@ void TrackLoggerCSV::next_line()
{
out << std::endl;
first_col = true;
-} \ No newline at end of file
+}
+
diff --git a/opentrack-logic/tracklogger.hpp b/opentrack-logic/tracklogger.hpp
index 990fc88b..c6c145cf 100644
--- a/opentrack-logic/tracklogger.hpp
+++ b/opentrack-logic/tracklogger.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "main-settings.hpp"
#include "opentrack-compat/options.hpp"
+#include "opentrack-compat/timer.hpp"
#include <fstream>
#include <QString>
@@ -14,6 +15,8 @@ class OPENTRACK_LOGIC_EXPORT TrackLogger
TrackLogger& operator=(const TrackLogger&) = delete;
TrackLogger& operator=(TrackLogger&&) = delete;
+ Timer t;
+
public:
TrackLogger()
{
@@ -37,6 +40,9 @@ public:
{
write(p, 6);
}
+
+ void reset_dt();
+ void write_dt();
};