diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index a3e3dfdf0..de6cf1d03 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -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);