#include "netdev.h"
#include "ofp-print.h"
#include "poll-loop.h"
+#include "timeval.h"
#define THIS_MODULE VLM_dhcp_client
#include "vlog.h"
cli->aux = aux;
cli->netdev = netdev;
cli->state = S_RELEASED;
- cli->state_entered = time(0);
+ cli->state_entered = time_now();
cli->xid = random_uint32();
cli->ipaddr = 0;
cli->server_ip = 0;
static void
do_force_renew(struct dhclient *cli, int deadline)
{
- time_t now = time(0);
+ time_t now = time_now();
unsigned int lease_left = sat_sub(cli->lease_expiration, now);
if (lease_left <= deadline) {
if (cli->state & (S_RENEWING | S_REBINDING)) {
t1 = calc_t1(lease, t2);
}
- cli->lease_expiration = sat_add(time(0), lease);
+ cli->lease_expiration = sat_add(time_now(), lease);
cli->bound_timeout = t1;
cli->renewing_timeout = t2 - t1;
cli->rebinding_timeout = lease - t2;
VLOG_DBG("entering %s", state_name(state));
cli->state = state;
}
- cli->state_entered = time(0);
+ cli->state_entered = time_now();
cli->retransmit = cli->delay = 0;
am_bound = dhclient_is_bound(cli);
if (was_bound != am_bound) {
static unsigned int
elapsed_in_this_state(const struct dhclient *cli)
{
- return time(0) - cli->state_entered;
+ return time_now() - cli->state_entered;
}
static bool
timeout(struct dhclient *cli, unsigned int secs)
{
cli->min_timeout = MIN(cli->min_timeout, secs);
- return time(0) >= sat_add(cli->state_entered, secs);
+ return time_now() >= sat_add(cli->state_entered, secs);
}
static bool