Added time_point overloads for creating timestamps. (#128)

* Added time_point overloads for creating timestamps.

* aliased std::chrono types
This commit is contained in:
Alex Damian
2018-10-25 10:39:22 -04:00
committed by Matias Fontanini
parent ad9a1e4a49
commit 57268e666c
4 changed files with 41 additions and 7 deletions

View File

@@ -240,12 +240,19 @@ public:
};
/**
* Constructs a timestamp object
* Constructs a timestamp object using a 'duration'.
*/
MessageTimestamp(std::chrono::milliseconds timestamp, TimestampType type);
/**
* Constructs a timestamp object using a 'time_point'.
*/
template <typename Clock, typename Duration = typename Clock::duration>
MessageTimestamp(std::chrono::time_point<Clock, Duration> timestamp, TimestampType type);
/**
* Gets the timestamp value
* Gets the timestamp value. If the timestamp was created with a 'time_point',
* the duration represents the number of milliseconds since epoch.
*/
std::chrono::milliseconds get_timestamp() const;