From ad1940d6144319d4ff06579d8f1f7279536ce7f6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 17 Jul 2019 19:10:01 -0700 Subject: [PATCH] ircd::db::env: Add NowNanos() override. --- include/ircd/db/database/env/env.h | 1 + ircd/db_env.cc | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/ircd/db/database/env/env.h b/include/ircd/db/database/env/env.h index a8a1ea702..3ad1ae924 100644 --- a/include/ircd/db/database/env/env.h +++ b/include/ircd/db/database/env/env.h @@ -76,6 +76,7 @@ struct ircd::db::database::env final unsigned int GetThreadPoolQueueLen(Priority pri = LOW) const noexcept override; Status GetTestDirectory(std::string* path) noexcept override; Status NewLogger(const std::string& fname, std::shared_ptr* result) noexcept override; + uint64_t NowNanos() noexcept override; uint64_t NowMicros() noexcept override; void SleepForMicroseconds(int micros) noexcept override; Status GetHostName(char* name, uint64_t len) noexcept override; diff --git a/ircd/db_env.cc b/ircd/db_env.cc index b3aaad1b2..005bfce55 100644 --- a/ircd/db_env.cc +++ b/ircd/db_env.cc @@ -730,6 +730,13 @@ catch(const std::exception &e) }; } +uint64_t +ircd::db::database::env::NowNanos() +noexcept +{ + return duration_cast(ircd::now().time_since_epoch()).count(); +} + rocksdb::Status ircd::db::database::env::GetCurrentTime(int64_t *const unix_time) noexcept try