]> 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)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Aug 2022 22:51:09 +0000 (00:51 +0200)
commit0c17bd232d20413b2bca83c5370fb7b0b6f725fe
treead32e44f86734dbfa1fd730715002b03bcd58085
parent8ecd9cdf30267a17cd2e101dc9584d4711e5bb64
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