From ae42b9c012e10972eb1e666d9d17d4903940b906 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 20 Jun 2015 16:01:32 +0200 Subject: o Adding a tool to add timestamps to each sample. (old wip code) --- sensor/main/sensor.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'sensor/main') diff --git a/sensor/main/sensor.cpp b/sensor/main/sensor.cpp index a773e0b..be3d31e 100644 --- a/sensor/main/sensor.cpp +++ b/sensor/main/sensor.cpp @@ -53,6 +53,30 @@ std::istream& operator>>(std::istream& is, sample_format_type& type) { return is; } +std::ostream& operator<<(std::ostream& os, time_resolution const& type) { + if (type == time_resolution::SECONDS) { + os << "seconds"; + } else if(type == time_resolution::MILLISECONDS) { + os << "milliseconds"; + } + + return os; +} + +std::istream& operator>>(std::istream& is, time_resolution & type) { + string s; + + is >> s; + + if(s == "seconds") { + type = time_resolution::SECONDS; + } else if(s == "milliseconds") { + type = time_resolution::MILLISECONDS; + } + + return is; +} + template<> const o SampleRecord::lexical_at(const SampleKey *key) const { auto value = at(key); -- cgit v1.2.3