Handle systems with broken gettimeofday system calls
Job #758142 failed for a38a3244:
isc_stdtime_get corrects systems which gettimeofday returns a out-of-range tv_usec field by adding and subtracting seconds from tv_sec and tv_usec as appropriate. This results in a seconds value which is outside the expected range by 1 (too large) based on observed failures.
I:nsupdate:check that unixtime serial number is correctly generated (7)
I:nsupdate:out-of-range serial=1584313212 > now=1584313211
I:nsupdate:failed
n=`expr $n + 1`
ret=0
echo_i "check that unixtime serial number is correctly generated ($n)"
$DIG $DIGOPTS +short unixtime.nil. soa @10.53.0.1 > dig.out.old.test$n || ret=1
oldserial=`awk '{print $3}' dig.out.old.test$n` || ret=1
start=`$PERL -e 'print time()."\n";'`
$NSUPDATE <<END > /dev/null 2>&1 || ret=1
server 10.53.0.1 ${PORT}
ttl 600
update add new.unixtime.nil in a 1.2.3.4
send
END
now=`$PERL -e 'print time()."\n";'`
sleep 1
$DIG $DIGOPTS +short unixtime.nil. soa @10.53.0.1 > dig.out.new.test$n || ret=1
serial=`awk '{print $3}' dig.out.new.test$n` || ret=1
[ "$oldserial" = "$serial" ] && { echo_i "oldserial == serial"; ret=1; }
if [ "$serial" -lt "$start" ]; then
echo_i "out-of-range serial=$serial < start=$start"; ret=1;
elif [ "$serial" -gt "$now" ]; then
echo_i "out-of-range serial=$serial > now=$now"; ret=1;
fi
[ $ret = 0 ] || { echo_i "failed"; status=1; }
15-Mar-2020 23:00:11.995 journal file unixtime.db.jnl does not exist, creating it
15-Mar-2020 23:00:11.995 writing to journal
15-Mar-2020 23:00:11.995 del unixtime.nil. 300 IN SOA ns1.unixtime.nil. hostmaster.unixtime.nil. 1 2000 2000 1814400 3600
15-Mar-2020 23:00:11.995 add unixtime.nil. 300 IN SOA ns1.unixtime.nil. hostmaster.unixtime.nil. 1584313212 2000 2000 1814400 3600
15-Mar-2020 23:00:11.995 add new.unixtime.nil. 600 IN A 1.2.3.4
1584313212 is 15-Mar-2020 23:00:12
Edited by Mark Andrews