]> Savannah Git Hosting - gnulib.git/commit
timespec-sub: fix overflow bug; add tests
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Nov 2015 01:41:43 +0000 (17:41 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Nov 2015 01:43:20 +0000 (17:43 -0800)
commit051613c240910cacdd83cb4f6a431f5435124243
tree1c8a74f1313ea074db08760fd333abe71841fdca
parentca64874789ae1a4932ff547a52d816c4bea91f62
timespec-sub: fix overflow bug; add tests

* lib/timespec-add.c (timespec_add):
* lib/timespec-sub.c (timespec_sub):
Work even if time_t is narrower than int (a theoretical
possibility).  Redo code for a bit more clarity.
* lib/timespec-sub.c (timespec_sub):
Fix off-by-2 bug if a.tv_sec == TYPE_MINIMUM (time_t) and 0 < b.tv_sec.
* modules/timespec-tests, tests/test-timespec.c: New files.
ChangeLog
lib/timespec-add.c
lib/timespec-sub.c
modules/timespec-tests [new file with mode: 0644]
tests/test-timespec.c [new file with mode: 0644]