integer arithmetic types: correct perhaps-possible negative timeout situation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jun 2011 19:35:47 +0000 (20:35 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Jun 2011 11:07:26 +0000 (12:07 +0100)
commit0009e60a914ef5239ba2f8cc19e07ab5368e49b1
treed77c9e112b9ba106fe5b27a4bb340eb378153232
parentbb9d056157e37451ec14800d5914733a625f1901
integer arithmetic types: correct perhaps-possible negative timeout situation

site_settimeout assumes that its timeout parameter is not before now.
Following the logic of the code this would appear to be currently
true, although I'm not absolutely certain.

Nevertheless it would be better to avoid this assumption.  Instead,
use a signed variable for the time until the timeout, and explicitly
turn negative values into zero.

The use of an int64_t will not cause an arithmetic overflow provided
that no timeouts are more than 2^64 milliseconds (around 580x10^6 yr)
in the past or the future.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
site.c