]> Savannah Git Hosting - gnulib.git/commit
gettime-res: fix unlikely overflow bug
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Feb 2022 21:13:09 +0000 (13:13 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Feb 2022 21:13:34 +0000 (13:13 -0800)
commitbc25238849ed25a0a16b87f7d4bba3d091c49325
treeabc8b4c4328097b539756608c9c84585e0823644
parent532b4c9f21473559657e273ef9f8f6fc8c7c2ab1
gettime-res: fix unlikely overflow bug

* lib/gettime-res.c (gettime_res): Fix bug when hz * tv_sec overflows.
With 64-bit ‘long’ and nanosecond resolution the bug can occur
starting in the year 2262, with probability about 2e-9.
With 32-bit ‘long’ the bug can occur now, with same probability.
The probability goes up on hosts with worse timestamp resolution.
ChangeLog
lib/gettime-res.c