X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=blobdiff_plain;f=src%2Fdhcpv6.c;h=9b4247ca9fde4ef9f01426c33fe279c2f47f5dfd;hp=d2cd656e5ae59bede3a2906d6c58ae3fc13ccfb6;hb=feec1ad5767b977ce47e6738930c99c22ba0ce9c;hpb=dbf89816bd12d727dc7b006406f619ff3d2da382 diff --git a/src/dhcpv6.c b/src/dhcpv6.c index d2cd656..9b4247c 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -667,13 +667,15 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig, uint8_t *odata; uint16_t otype, olen; - static time_t last_update = 0; - time_t now = odhcp6c_get_milli_time() / 1000; - - uint32_t elapsed = now - last_update; odhcp6c_expire(); if (orig == DHCPV6_MSG_UNKNOWN) { + static time_t last_update = 0; + time_t now = odhcp6c_get_milli_time() / 1000; + + uint32_t elapsed = (last_update > 0) ? now - last_update : 0; + last_update = now; + t1 -= elapsed; t2 -= elapsed; t3 -= elapsed;