mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 23:50:08 +08:00
Fix serverTime diff: ignore serverTime when it is zero
This commit is contained in:
parent
103dad3f69
commit
2247543f65
@ -158,9 +158,10 @@ internal class StatSvc {
|
||||
bot.configuration.statHeartbeatPeriodMillis = it.times(1000).toLong()
|
||||
}
|
||||
|
||||
val diffMillis = packet.origin.serverTime - currentTimeMillis()
|
||||
val serverTime = packet.origin.serverTime
|
||||
val diffMillis = if (serverTime == 0L) 0 else serverTime - currentTimeMillis()
|
||||
bot.components[ClockHolder].server = Clock.SystemDefault.adjusted(diffMillis)
|
||||
bot.network.logger.info { "Server time updated, diff: ${diffMillis}ms=${diffMillis.millisToHumanReadableString()}" }
|
||||
bot.network.logger.info { "Server time updated, serverTime: $serverTime, diff: ${diffMillis}ms=${diffMillis.millisToHumanReadableString()}" }
|
||||
}
|
||||
|
||||
fun online(
|
||||
|
Loading…
Reference in New Issue
Block a user