ntsservercert tmp/server.crt
ntsprocesses 0
ntsrotate 64
+ntsdumpdir tmp
"
client_server_options="minpoll 6 maxpoll 6 nts"
client_conf="
check_source_selection || test_fail
check_sync || test_fail
-check_file_messages "20.*123\.1.* 111 111 1111" 90 93 measurements.log || test_fail
+check_file_messages "20.*123\.1.* 111 111 1111" 89 93 measurements.log || test_fail
check_file_messages "20.*123\.1.* 111 001 0000" 30 32 measurements.log || test_fail
+check_file_messages " 2 1 .* 11443 " 200 240 log.packets || test_fail
+check_file_messages "." 6 6 ntskeys || test_fail
rm -f tmp/measurements.log
client_conf+="
-ntsrefresh 120"
+ntsrefresh 120
+ntsdumpdir tmp"
run_test || test_fail
check_chronyd_exit || test_fail
check_file_messages "20.*123\.1.* 111 111 1111" 99 103 measurements.log || test_fail
check_file_messages "20.*123\.1.* 111 001 0000" 0 0 measurements.log || test_fail
+check_file_messages " 2 1 .* 11443 " 350 390 log.packets || test_fail
+check_file_messages "." 6 6 ntskeys || test_fail
+check_file_messages "." 11 12 192.168.123.1.nts || test_fail
+rm -f tmp/measurements.log
+
+export CLKNETSIM_START_DATE=$(date -d 'Jan 1 00:00:00 UTC 2010 + 40000 sec' +'%s')
+
+server_conf+="
+ntsrotate 100000"
+client_conf+="
+ntsrefresh 39500"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection || test_fail
+check_sync || test_fail
+
+check_file_messages "20.*123\.1.* 111 111 1111" 150 160 measurements.log || test_fail
+check_file_messages "20.*123\.1.* 111 001 0000" 0 0 measurements.log || test_fail
+check_file_messages " 2 1 .* 11443 " 6 10 log.packets || test_fail
+check_file_messages "^9\.......e+03 2 1 .* 11443 " 6 10 log.packets || test_fail
+check_file_messages "." 6 6 ntskeys || test_fail
+check_file_messages "." 11 12 192.168.123.1.nts || test_fail
rm -f tmp/measurements.log
client_conf="
check_source_selection && test_fail
check_sync && test_fail
+check_file_messages " 2 1 .* 123 " 0 0 log.packets || test_fail
+check_file_messages " 2 1 .* 11443 " 10 20 log.packets || test_fail
+
test_pass