allowed_time.set_from_double(g_clock.now() + g_conf.mon_clock_drift_allowed);
if (lease->sent_timestamp > allowed_time) {
utime_t warn_diff = g_clock.now() - last_clock_drift_warn;
- if ((last_clock_drift_warn == utime_t()) ||
- (warn_diff >
- pow(g_conf.mon_clock_drift_warn_backoff, clock_drift_warned))) {
+ if (warn_diff >
+ pow(g_conf.mon_clock_drift_warn_backoff, clock_drift_warned)) {
stringstream ss;
ss << "lease_expire from mon" << lease->get_source().num()
<< " was sent from future time " << lease->sent_timestamp
utime_t allowed_time;
allowed_time.set_from_double(g_clock.now() + g_conf.mon_clock_drift_allowed);
if (ack->sent_timestamp > allowed_time) {
- stringstream ss;
- ss << "lease_ack from mon" << from
- << " was sent from future time " << ack->sent_timestamp
- << " with allowed time <=" << allowed_time
- << ", clocks not synchronized." << std::endl;
- mon->get_logclient()->log(LOG_WARN, ss);
+ utime_t warn_diff = g_clock.now() - last_clock_drift_warn;
+ if (warn_diff >
+ pow(g_conf.mon_clock_drift_warn_backoff, clock_drift_warned)) {
+ stringstream ss;
+ ss << "lease_ack from mon" << from
+ << " was sent from future time " << ack->sent_timestamp
+ << " with allowed time <=" << allowed_time
+ << ", clocks not synchronized." << std::endl;
+ mon->get_logclient()->log(LOG_WARN, ss);
+ last_clock_drift_warn = g_clock.now();
+ ++clock_drift_warned;
+ }
}
ack->put();
}