Add warning when date is greater than known server time.

GitOrigin-RevId: 365fe5f127671336a633a2ca8fab10e3ea313e2b
This commit is contained in:
levlam 2018-02-11 20:21:18 +03:00
parent 4a3a5e1a50
commit be5d7a7059

View File

@ -306,6 +306,15 @@ void UpdatesManager::set_date(int32 date, bool from_update, string date_source)
return;
}
}
auto now = G()->unix_time();
if (date_ > now + 1) {
LOG(ERROR) << "Receive wrong by " << (date_ - now) << " date = " << date_ << " from " << date_source
<< ". Now = " << now;
date_ = now;
if (date_ <= date) {
return;
}
}
date_ = date;
date_source_ = std::move(date_source);