Although *chronyd* will trim the rate at which it samples the server during
normal operation, the user might want to constrain the minimum polling interval.
This is always defined as a power of 2, so *minpoll 5* would mean that the
-polling interval cannot drop below 32 seconds. The default is 6 (64 seconds).
+polling interval cannot drop below 32 seconds. The default is 6 (64 seconds),
+the minimum is -4 (1/16th of a second), and the maximum is 24 (6 months). Note
+that intervals shorter than 6 (64 seconds) should generally not be used with
+public servers on the Internet as their administrators may consider it abuse.
*maxpoll* _poll_:::
In a similar way, the user might want to constrain the maximum polling interval.
Again this is specified as a power of 2, *maxpoll 9* indicates that the polling
-interval must stay at or below 512 seconds. The default is 10 (1024 seconds).
+interval must stay at or below 512 seconds. The default is 10 (1024 seconds),
+the minimum is 0 (1 second), and the maximum is 24 (6 months).
*iburst*:::
If this option is set, the interval between the first four polls will be 2
seconds instead of _minpoll_. This is useful to quickly get the first update of
#define MAX_MAXDELAYDEVRATIO 1.0e6
/* Minimum and maximum allowed poll interval */
-#define MIN_POLL 0
+#define MIN_MINPOLL -4
+#define MIN_MAXPOLL 0
#define MAX_POLL 24
/* Kiss-o'-Death codes */
result->interleaved = params->interleaved;
result->minpoll = params->minpoll;
- if (result->minpoll < MIN_POLL)
+ if (result->minpoll < MIN_MINPOLL)
result->minpoll = SRC_DEFAULT_MINPOLL;
else if (result->minpoll > MAX_POLL)
result->minpoll = MAX_POLL;
result->maxpoll = params->maxpoll;
- if (result->maxpoll < MIN_POLL)
+ if (result->maxpoll < MIN_MAXPOLL)
result->maxpoll = SRC_DEFAULT_MAXPOLL;
else if (result->maxpoll > MAX_POLL)
result->maxpoll = MAX_POLL;
approx the poll interval away */
poll_to_use = inst->local_poll;
- delay_time = (double) (1UL<<poll_to_use);
+ delay_time = UTI_Log2ToDouble(poll_to_use);
if (inst->presend_done)
delay_time = WARM_UP_DELAY;
if (poll_to_use < inst->minpoll)
poll_to_use = inst->minpoll;
- delay_time = (double) (1UL<<poll_to_use);
+ delay_time = UTI_Log2ToDouble(poll_to_use);
/* If the remote stratum is higher than ours, try to lock on the
peer's polling to minimize our response time by slightly extending
UTI_IPToString(&inst->remote_addr.ip_addr));
/* Back off for a while and stop ongoing burst */
- delay_time += 4 * (1UL << inst->local_poll);
+ delay_time += 4 * UTI_Log2ToDouble(inst->local_poll);
if (inst->opmode == MD_BURST_WAS_OFFLINE || inst->opmode == MD_BURST_WAS_ONLINE) {
inst->burst_good_samples_to_go = 0;
void
NCR_ModifyMinpoll(NCR_Instance inst, int new_minpoll)
{
- if (new_minpoll < MIN_POLL || new_minpoll > MAX_POLL)
+ if (new_minpoll < MIN_MINPOLL || new_minpoll > MAX_POLL)
return;
inst->minpoll = new_minpoll;
LOG(LOGS_INFO, LOGF_NtpCore, "Source %s new minpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_minpoll);
void
NCR_ModifyMaxpoll(NCR_Instance inst, int new_maxpoll)
{
- if (new_maxpoll < MIN_POLL || new_maxpoll > MAX_POLL)
+ if (new_maxpoll < MIN_MAXPOLL || new_maxpoll > MAX_POLL)
return;
inst->maxpoll = new_maxpoll;
LOG(LOGS_INFO, LOGF_NtpCore, "Source %s new maxpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_maxpoll);
destination->addr.port = port;
destination->local_addr.ip_addr.family = IPADDR_UNSPEC;
destination->local_addr.sock_fd = NIO_OpenServerSocket(&destination->addr);
- destination->interval = CLAMP(1 << MIN_POLL, interval, 1 << MAX_POLL);
+ destination->interval = CLAMP(1, interval, 1 << MAX_POLL);
SCH_AddTimeoutInClass(destination->interval, SAMPLING_SEPARATION, SAMPLING_RANDOMNESS,
SCH_NtpBroadcastClass, broadcast_timeout,