Upgraded the rest of Time.
Change-Id: I0ee083837e51d8f74a798b7ba14a3b6bb3859f35
diff --git a/y2016/dashboard/dashboard.cc b/y2016/dashboard/dashboard.cc
index 16ad077..798c08b 100644
--- a/y2016/dashboard/dashboard.cc
+++ b/y2016/dashboard/dashboard.cc
@@ -1,11 +1,12 @@
#include "y2016/dashboard/dashboard.h"
+#include <chrono>
+#include <complex>
#include <iostream>
#include <sstream>
#include <string>
#include <thread>
#include <vector>
-#include <complex>
#include "seasocks/Server.h"
@@ -22,6 +23,8 @@
#include "y2016/dashboard/embedded.h"
+namespace chrono = ::std::chrono;
+
namespace y2016 {
namespace dashboard {
namespace big_indicator {
@@ -139,7 +142,7 @@
size_t index = GetIndex(sample_id_);
- ItemDatapoint datapoint{value, ::aos::time::Time::Now()};
+ ItemDatapoint datapoint{value, ::aos::monotonic_clock::now()};
if (measure_index_ >= sample_items_.size()) {
// New item in our data table.
::std::vector<ItemDatapoint> datapoints;
@@ -194,9 +197,12 @@
if (static_cast<size_t>(adjusted_index) <
sample_items_.at(0).datapoints.size()) {
message << cur_sample << "%"
- << sample_items_.at(0)
- .datapoints.at(adjusted_index)
- .time.ToSeconds() << "%"; // Send time.
+ << chrono::duration_cast<chrono::duration<double>>(
+ sample_items_.at(0)
+ .datapoints.at(adjusted_index)
+ .time.time_since_epoch())
+ .count()
+ << "%"; // Send time.
// Add comma-separated list of data points.
for (size_t cur_measure = 0; cur_measure < sample_items_.size();
cur_measure++) {
@@ -220,8 +226,10 @@
void DataCollector::operator()() {
::aos::SetCurrentThreadName("DashboardData");
+ ::aos::time::PhasedLoop phased_loop(chrono::milliseconds(100),
+ chrono::seconds(0));
while (run_) {
- ::aos::time::PhasedLoopXMS(100, 0);
+ phased_loop.SleepUntilNext();
RunIteration();
}
}
diff --git a/y2016/dashboard/dashboard.h b/y2016/dashboard/dashboard.h
index 003820c..e093cb9 100644
--- a/y2016/dashboard/dashboard.h
+++ b/y2016/dashboard/dashboard.h
@@ -52,7 +52,7 @@
struct ItemDatapoint {
double value;
- ::aos::time::Time time;
+ ::aos::monotonic_clock::time_point time;
};
struct SampleItem {