]> Savannah Git Hosting - gnulib.git/commit
gethrxtime: fix rounding bug with negative args
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 22 Dec 2019 20:32:31 +0000 (12:32 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 22 Dec 2019 20:45:34 +0000 (12:45 -0800)
commit0da79aa8083359d3a97f7c743a28bd9f380caa92
treec61a4b5d87716669db3f88386aefab402d466bcc
parentf935bab8ad7e94938c857b30d75582731db5595a
gethrxtime: fix rounding bug with negative args

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2019-12/msg00192.html
* lib/xtime.h (xtime_sec): Simplify calculation and correct bug
with negative rounding.  Common platforms can compute / and % with
a single instruction, so the simplified code should be shorter and
faster on these platforms anyway.
ChangeLog
lib/xtime.h