Skip to content

Commit

Permalink
Fix time offset calculation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarnathCJD committed Jul 27, 2024
1 parent 627572a commit 451bead
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mtproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,10 @@ func (m *MTProto) offsetTime() {
return
}

if timeResponse.Unixtime < currentLocalTime {
return // -no need to offset time
}

m.timeOffset = timeResponse.Unixtime - currentLocalTime
m.Logger.Info("system time is out of sync, offsetting time by " + strconv.FormatInt(m.timeOffset, 10) + " seconds")
}
Expand Down

0 comments on commit 451bead

Please sign in to comment.