Files
scylladb/gc_clock.hh
Tomasz Grabiec 8c63459b3b Introduce GC clock
The clock used to expire tombstones and cells with time-to-live.

Origin uses 32-bit precision for this clock counting seconds since the
epoch. This means the clock will overflow not that far in the future,
but if we want to maintain compatibility on sstable level we need to
follow that.
2015-01-23 18:45:27 +01:00

22 lines
511 B
C++

/*
* Copyright 2015 Cloudius Systems
*/
#pragma once
#include <chrono>
// FIXME: wraps around in 2038
class gc_clock {
using base = std::chrono::system_clock;
public:
using rep = int32_t;
using period = std::ratio<1, 1>; // seconds
using duration = std::chrono::duration<rep, period>;
using time_point = std::chrono::time_point<gc_clock, duration>;
static time_point now() {
return time_point(std::chrono::duration_cast<duration>(base::now().time_since_epoch()));
}
};