diff options
author | Alex Auvolat <alex@adnab.me> | 2021-12-14 13:55:11 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-01-04 12:45:46 +0100 |
commit | 5b1117e582db16cc5aa50840a685875cbd5501f4 (patch) | |
tree | 06fec47bf56cb08cb51334454dc15f98352c98f2 /src/util/time.rs | |
parent | 8f6026de5ecd44cbe0fc0bcd47638a1ece860439 (diff) | |
download | garage-5b1117e582db16cc5aa50840a685875cbd5501f4.tar.gz garage-5b1117e582db16cc5aa50840a685875cbd5501f4.zip |
New model for buckets
Diffstat (limited to 'src/util/time.rs')
-rw-r--r-- | src/util/time.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util/time.rs b/src/util/time.rs index 238db2c3..d9192443 100644 --- a/src/util/time.rs +++ b/src/util/time.rs @@ -10,6 +10,11 @@ pub fn now_msec() -> u64 { .as_millis() as u64 } +/// Increment logical clock +pub fn increment_logical_clock(prev: u64) -> u64 { + std::cmp::max(prev + 1, now_msec()) +} + /// Convert a timestamp represented as milliseconds since UNIX Epoch to /// its RFC3339 representation, such as "2021-01-01T12:30:00Z" pub fn msec_to_rfc3339(msecs: u64) -> String { |