Properly round the TTL

This commit is contained in:
Frank Denis 2021-09-24 09:26:31 +02:00
parent 5fedbe4c6e
commit 3bae61dbe1
1 changed files with 1 additions and 1 deletions

View File

@ -196,7 +196,7 @@ func updateTTL(msg *dns.Msg, expiration time.Time) {
ttl := uint32(0)
if until > 0 {
ttl = uint32(until / time.Second)
if until-time.Duration(ttl)*time.Second < until/2 {
if until-time.Duration(ttl)*time.Second >= time.Second/2 {
ttl += 1
}
}