diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-19 21:55:23 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-19 21:55:23 +0100 |
commit | 97ad73ac5c0e8955fcc0478d12075423c8023e84 (patch) | |
tree | 6f903dcf51ddca76962d895b68028d86f3c9bd5a /apps/sample-timestamp.cpp | |
parent | 17de795175d0573d8ac6c2517d0eb35e8a4f8f69 (diff) | |
download | ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.tar.gz ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.tar.bz2 ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.tar.xz ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.zip |
o Fixing key-value output.
Diffstat (limited to 'apps/sample-timestamp.cpp')
-rw-r--r-- | apps/sample-timestamp.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/sample-timestamp.cpp b/apps/sample-timestamp.cpp index 4855506..df4a89e 100644 --- a/apps/sample-timestamp.cpp +++ b/apps/sample-timestamp.cpp @@ -18,7 +18,7 @@ public: timestamp_key(dict.indexOf(timestamp_name)), now_key(dict.indexOf(now_name)), start_time_(start_time), output_(output) { } - virtual void write(SampleRecord sample) override { + virtual void write(SampleRecord const &sample) override { o<long> relative_time_o = sample.lexical_at<long>(now_key); if (!relative_time_o) { @@ -28,9 +28,12 @@ public: long relative_time = relative_time_o.get(); string new_value = std::to_string(start_time_ + relative_time); - sample.set(timestamp_key, new_value); - output_->write(sample); + SampleRecord updatedSample(sample); + + updatedSample.set(timestamp_key, new_value); + + output_->write(updatedSample); }; private: |