timestamp_clock::now() is not noexcept

The problem is that `std::chrono::duration_cast` is not `noexcept`. As a result,
`timestamp_clock` is actually a model of `Clock` and not `TrivialClock`.
This commit is contained in:
Jesse Haber-Kucharsky
2017-06-21 21:03:14 -04:00
parent 28169fabca
commit 09954c45f1

View File

@@ -35,7 +35,7 @@ timestamp_type constexpr max_timestamp = std::numeric_limits<timestamp_type>::ma
// Used for generating server-side mutation timestamps.
// Same epoch as Java's System.currentTimeMillis() for compatibility.
// Satisfies requirements of TrivialClock.
// Satisfies requirements of Clock.
class timestamp_clock {
using base = std::chrono::system_clock;
public:
@@ -46,7 +46,7 @@ public:
static constexpr bool is_steady = base::is_steady;
static time_point now() noexcept {
static time_point now() {
return time_point(std::chrono::duration_cast<duration>(base::now().time_since_epoch())) + get_clocks_offset();
}
};