From 58fae227082dd09107f5389f2f054c4b6a6e1a20 Mon Sep 17 00:00:00 2001 From: Sowmya Ramapatruni Date: Mon, 2 Aug 2021 13:52:43 -0700 Subject: [PATCH] Fix issue-1689 --- src/Timer.cc | 2 +- src/util.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Timer.cc b/src/Timer.cc index e8f47cfbb4..ecf56dd057 100644 --- a/src/Timer.cc +++ b/src/Timer.cc @@ -152,7 +152,7 @@ void PQ_TimerMgr::Expire() int PQ_TimerMgr::DoAdvance(double new_t, int max_expire) { Timer* timer = Top(); - for ( num_expired = 0; (num_expired < max_expire || max_expire == 0) && + for ( num_expired = 0; (num_expired < max_expire ) && timer && timer->Time() <= new_t; ++num_expired ) { last_timestamp = timer->Time(); diff --git a/src/util.cc b/src/util.cc index 260866d30f..e1dbcc133e 100644 --- a/src/util.cc +++ b/src/util.cc @@ -885,9 +885,10 @@ double calc_next_rotate(double current, double interval, double base) double startofday = mktime(&t); // current < startofday + base + i * interval <= current + interval - return startofday + base + + double delta_t = startofday + base + ceil((current - startofday - base) / interval) * interval - current; + return delta_t > 0.0 ? delta_t: interval; } void terminate_processing()