Commit e3131ee4 by Juliusz Chroboczek

Rename timeval_plus_msec to timeval_add_msec.

Stress the asymmetry with timeval_add_msec, which is purely functional.
1 parent 2aa1abe5
...@@ -806,7 +806,7 @@ schedule_neighbours_check(int msecs, int override) ...@@ -806,7 +806,7 @@ schedule_neighbours_check(int msecs, int override)
{ {
struct timeval timeout; struct timeval timeout;
timeval_plus_msec(&timeout, &now, roughly(msecs * 3 / 2)); timeval_add_msec(&timeout, &now, roughly(msecs * 3 / 2));
if(override) if(override)
check_neighbours_timeout = timeout; check_neighbours_timeout = timeout;
else else
......
...@@ -121,7 +121,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -121,7 +121,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
(neigh->hello_interval * 10); (neigh->hello_interval * 10);
if(missed_hellos <= 0) if(missed_hellos <= 0)
return rc; return rc;
timeval_plus_msec(&neigh->hello_time, &neigh->hello_time, timeval_add_msec(&neigh->hello_time, &neigh->hello_time,
missed_hellos * neigh->hello_interval * 10); missed_hellos * neigh->hello_interval * 10);
} else { } else {
if(neigh->hello_seqno >= 0 && neigh->reach > 0) { if(neigh->hello_seqno >= 0 && neigh->reach > 0) {
......
...@@ -147,7 +147,7 @@ update_jitter(struct network *net, int urgent) ...@@ -147,7 +147,7 @@ update_jitter(struct network *net, int urgent)
void void
delay_jitter(struct timeval *timeout, int msecs) delay_jitter(struct timeval *timeout, int msecs)
{ {
timeval_plus_msec(timeout, &now, roughly(msecs)); timeval_add_msec(timeout, &now, roughly(msecs));
} }
static int static int
......
...@@ -138,7 +138,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen, ...@@ -138,7 +138,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
if(resend->delay) { if(resend->delay) {
struct timeval timeout; struct timeval timeout;
timeval_plus_msec(&timeout, &resend->time, resend->delay); timeval_add_msec(&timeout, &resend->time, resend->delay);
timeval_min(&resend_time, &timeout); timeval_min(&resend_time, &timeout);
} }
return 1; return 1;
...@@ -268,7 +268,7 @@ recompute_resend_time() ...@@ -268,7 +268,7 @@ recompute_resend_time()
while(request) { while(request) {
if(!resend_expired(request) && request->delay > 0 && request->max > 0) { if(!resend_expired(request) && request->delay > 0 && request->max > 0) {
struct timeval timeout; struct timeval timeout;
timeval_plus_msec(&timeout, &request->time, request->delay); timeval_add_msec(&timeout, &request->time, request->delay);
timeval_min(&resend, &timeout); timeval_min(&resend, &timeout);
} }
request = request->next; request = request->next;
...@@ -286,7 +286,7 @@ do_resend() ...@@ -286,7 +286,7 @@ do_resend()
while(resend) { while(resend) {
if(!resend_expired(resend) && resend->delay > 0 && resend->max > 0) { if(!resend_expired(resend) && resend->delay > 0 && resend->max > 0) {
struct timeval timeout; struct timeval timeout;
timeval_plus_msec(&timeout, &resend->time, resend->delay); timeval_add_msec(&timeout, &resend->time, resend->delay);
if(timeval_compare(&now, &timeout) >= 0) { if(timeval_compare(&now, &timeout) >= 0) {
switch(resend->kind) { switch(resend->kind) {
case RESEND_REQUEST: case RESEND_REQUEST:
......
...@@ -77,7 +77,7 @@ timeval_minus_msec(const struct timeval *s1, const struct timeval *s2) ...@@ -77,7 +77,7 @@ timeval_minus_msec(const struct timeval *s1, const struct timeval *s2)
} }
void void
timeval_plus_msec(struct timeval *d, const struct timeval *s, int msecs) timeval_add_msec(struct timeval *d, const struct timeval *s, int msecs)
{ {
int usecs; int usecs;
d->tv_sec = s->tv_sec + msecs / 1000; d->tv_sec = s->tv_sec + msecs / 1000;
......
...@@ -71,8 +71,8 @@ void timeval_minus(struct timeval *d, ...@@ -71,8 +71,8 @@ void timeval_minus(struct timeval *d,
const struct timeval *s1, const struct timeval *s2); const struct timeval *s1, const struct timeval *s2);
unsigned timeval_minus_msec(const struct timeval *s1, const struct timeval *s2) unsigned timeval_minus_msec(const struct timeval *s1, const struct timeval *s2)
ATTRIBUTE ((pure)); ATTRIBUTE ((pure));
void timeval_plus_msec(struct timeval *d, void timeval_add_msec(struct timeval *d,
const struct timeval *s, int msecs); const struct timeval *s, int msecs);
int timeval_compare(const struct timeval *s1, const struct timeval *s2) int timeval_compare(const struct timeval *s1, const struct timeval *s2)
ATTRIBUTE ((pure)); ATTRIBUTE ((pure));
void timeval_min(struct timeval *d, const struct timeval *s); void timeval_min(struct timeval *d, const struct timeval *s);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!