gc_clock, db_clock: mark functions noexcept

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-05-29 11:35:09 +03:00
parent 724692e7f4
commit b5f9a3d44e
2 changed files with 4 additions and 4 deletions

View File

@@ -33,13 +33,13 @@ public:
static constexpr time_point from_time_t(std::time_t t) {
return time_point(std::chrono::duration_cast<duration>(std::chrono::seconds(t)));
}
static time_point now() {
static time_point now() noexcept {
return time_point(std::chrono::duration_cast<duration>(base::now().time_since_epoch())) + get_clocks_offset();
}
};
static inline
gc_clock::time_point to_gc_clock(db_clock::time_point tp) {
gc_clock::time_point to_gc_clock(db_clock::time_point tp) noexcept {
// Converting time points through `std::time_t` means that we don't have to make any assumptions about the epochs
// of `gc_clock` and `db_clock`, though we require that that the period of `gc_clock` is also 1 s like
// `std::time_t` to avoid loss of information.

View File

@@ -34,7 +34,7 @@ public:
return time_point(std::chrono::duration_cast<duration>(std::chrono::seconds(t)));
}
static time_point now() {
static time_point now() noexcept {
return time_point(std::chrono::duration_cast<duration>(base::now().time_since_epoch())) + get_clocks_offset();
}
@@ -63,7 +63,7 @@ std::ostream& operator<<(std::ostream& os, gc_clock::time_point tp);
template<>
struct appending_hash<gc_clock::time_point> {
template<typename Hasher>
void operator()(Hasher& h, gc_clock::time_point t) const {
void operator()(Hasher& h, gc_clock::time_point t) const noexcept {
// Remain backwards-compatible with the 32-bit duration::rep (refs #4460).
uint64_t d64 = t.time_since_epoch().count();
feed_hash(h, uint32_t(d64 & 0xffff'ffff));