improve: 优化可能造成流量统计异常的情况

This commit is contained in:
naiba
2024-08-11 10:35:19 +08:00
parent c18e0e420e
commit b1d77a1d27
6 changed files with 39 additions and 28 deletions

View File

@@ -76,3 +76,10 @@ func GenerateRandomString(n int) (string, error) {
}
return string(ret), nil
}
func Uint64SubInt64(a uint64, b int64) uint64 {
if b < 0 {
return a + uint64(-b)
}
return a - uint64(b)
}