diff options
-rw-r--r-- | fnet/src/tests/scheduling/schedule.cpp | 2 | ||||
-rw-r--r-- | fnet/src/vespa/fnet/scheduler.cpp | 3 | ||||
-rw-r--r-- | fnet/src/vespa/fnet/scheduler.h | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/fnet/src/tests/scheduling/schedule.cpp b/fnet/src/tests/scheduling/schedule.cpp index d2d1173ccbf..b61328a5901 100644 --- a/fnet/src/tests/scheduling/schedule.cpp +++ b/fnet/src/tests/scheduling/schedule.cpp @@ -46,7 +46,7 @@ public: if (b < a) return false; - if ((b - a) > (3 * FNET_Scheduler::tick_ms.count())) + if ((b - a) > (3 * vespalib::count_ms(FNET_Scheduler::tick_ms))) return false; return true; diff --git a/fnet/src/vespa/fnet/scheduler.cpp b/fnet/src/vespa/fnet/scheduler.cpp index ba1e9f57f4a..c6b1263bf61 100644 --- a/fnet/src/vespa/fnet/scheduler.cpp +++ b/fnet/src/vespa/fnet/scheduler.cpp @@ -8,6 +8,7 @@ #include <vespa/log/log.h> LOG_SETUP(".fnet.scheduler"); +const vespalib::duration FNET_Scheduler::tick_ms = vespalib::from_s(10*1.0/vespalib::getVespaTimerHz()); FNET_Scheduler::FNET_Scheduler(vespalib::steady_time *sampler) : _cond(), @@ -65,7 +66,7 @@ FNET_Scheduler::Schedule(FNET_Task *task, double seconds) { constexpr double ONE_MONTH_S = 3600 * 24 * 30; seconds = std::min(seconds, ONE_MONTH_S); - uint32_t ticks = 2 + (uint32_t) std::ceil(seconds * (1000.0 / tick_ms.count())); + uint32_t ticks = 2 + (uint32_t) std::ceil(seconds * (1000.0 / vespalib::count_ms(tick_ms))); std::lock_guard<std::mutex> guard(_lock); if (!task->_killed) { diff --git a/fnet/src/vespa/fnet/scheduler.h b/fnet/src/vespa/fnet/scheduler.h index 0a6c9259ccc..d9a65efde34 100644 --- a/fnet/src/vespa/fnet/scheduler.h +++ b/fnet/src/vespa/fnet/scheduler.h @@ -20,7 +20,7 @@ class FNET_Scheduler { public: using clock = vespalib::steady_clock; - static constexpr auto tick_ms = 10ms; + static const vespalib::duration tick_ms; enum scheduler_constants { NUM_SLOTS = 4096, |