Commit 065ca165 authored by Dominik Charousset's avatar Dominik Charousset

Consitently use ISO 8601 for printing timestamps

parent 6f24e37a
......@@ -33,11 +33,11 @@ using timestamp = std::chrono::time_point<std::chrono::system_clock, timespan>;
/// the current system time.
timestamp make_timestamp();
/// Converts the time-since-epoch of `x` to a `string`.
std::string timestamp_to_string(const timestamp& x);
/// Prints `x` in ISO 8601 format, e.g., `2018-11-15T06:25:01.462`.
std::string timestamp_to_string(timestamp x);
/// Appends the time-since-epoch of `y` to `x`.
void append_timestamp_to_string(std::string& x, const timestamp& y);
/// Appends the timestamp `x` in ISO 8601 format, e.g.,
/// `2018-11-15T06:25:01.462`, to `y`.
void append_timestamp_to_string(std::string& x, timestamp y);
} // namespace caf
......@@ -16,6 +16,7 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/deep_to_string.hpp"
#include "caf/timestamp.hpp"
namespace caf {
......@@ -24,12 +25,12 @@ timestamp make_timestamp() {
return std::chrono::system_clock::now();
}
std::string timestamp_to_string(const timestamp& x) {
return std::to_string(x.time_since_epoch().count());
std::string timestamp_to_string(timestamp x) {
return deep_to_string(x.time_since_epoch().count());
}
void append_timestamp_to_string(std::string& x, const timestamp& y) {
x += std::to_string(y.time_since_epoch().count());
void append_timestamp_to_string(std::string& x, timestamp y) {
x += timestamp_to_string(y);
}
} // namespace caf
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment