Fix localtime-related slowmode errors.

This commit is contained in:
John Preston
2019-08-20 12:42:13 +03:00
parent 1a06714f3a
commit e1fe373504
9 changed files with 35 additions and 25 deletions
+5 -4
View File
@@ -713,10 +713,11 @@ bool PeerData::slowmodeApplied() const {
int PeerData::slowmodeSecondsLeft() const {
if (const auto channel = asChannel()) {
if (const auto last = channel->slowmodeLastMessage()) {
const auto seconds = channel->slowmodeSeconds();
const auto now = base::unixtime::now();
return std::max(seconds - (now - last), 0);
if (const auto seconds = channel->slowmodeSeconds()) {
if (const auto last = channel->slowmodeLastMessage()) {
const auto now = base::unixtime::now();
return std::max(seconds - (now - last), 0);
}
}
}
return 0;