interval = INTERVAL_QUERY_NORMAL * (1 / abs_offset);
interval = INTERVAL_QUERY_NORMAL * (QSCALE_OFF_MAX / abs_offset);
client_dispatch(struct ntp_peer *p){	struct sockaddr_storage	 fsa;	socklen_t		 fsa_len;	char			 buf[NTP_MSGSIZE];	ssize_t			 size;	struct ntp_msg		 msg;	double			 T1, T2, T3, T4;	double			 abs_offset;	time_t			 interval;	fsa_len = sizeof(fsa);	if ((size = recvfrom(p->query->fd, &buf, sizeof(buf), 0,	    (struct sockaddr *)&fsa, &fsa_len)) == -1)		fatal("recvfrom");	T4 = gettime();	ntp_getmsg(buf, size, &msg);	if (msg.orgtime.int_part != p->query->msg.xmttime.int_part ||	    msg.orgtime.fraction != p->query->msg.xmttime.fraction)		return (0);	/*	 * From RFC 2030 (with a correction to the delay math):	 *	 *      Timestamp Name          ID   When Generated	 *     ------------------------------------------------------------	 *     Originate Timestamp     T1   time request sent by client	 *     Receive Timestamp       T2   time request received by server	 *     Transmit Timestamp      T3   time reply sent by server	 *     Destination Timestamp   T4   time reply received by client	 *	 *  The roundtrip delay d and local clock offset t are defined as	 *	 *    d = (T4 - T1) - (T3 - T2)     t = ((T2 - T1) + (T3 - T4)) / 2.	 */	T1 = p->query->xmttime;	T2 = lfp_to_d(msg.rectime);	T3 = lfp_to_d(msg.xmttime);	p->reply[p->shift].offset = ((T2 - T1) + (T3 - T4)) / 2;	p->reply[p->shift].delay = (T4 - T1) - (T3 - T2);	p->reply[p->shift].error = (T2 - T1) - (T3 - T4);	p->reply[p->shift].rcvd = time(NULL);	p->reply[p->shift].good = 1;	p->reply[p->shift].status.leap = (msg.status & LIMASK) >> 6;	p->reply[p->shift].status.precision = msg.precision;	p->reply[p->shift].status.rootdelay = sfp_to_d(msg.distance);	p->reply[p->shift].status.rootdispersion = sfp_to_d(msg.dispersion);	p->reply[p->shift].status.refid = htonl(msg.refid);	p->reply[p->shift].status.reftime = lfp_to_d(msg.reftime);	p->reply[p->shift].status.poll = msg.ppoll;	if (p->trustlevel < TRUSTLEVEL_PATHETIC)		interval = INTERVAL_QUERY_PATHETIC;	else if (p->trustlevel < TRUSTLEVEL_AGRESSIVE)		interval = INTERVAL_QUERY_AGRESSIVE;	else {		if (p->update.offset < 0)			abs_offset = p->update.offset * -1;		else			abs_offset = p->update.offset;		if (!p->update.good)			interval = INTERVAL_QUERY_NORMAL;		else if (abs_offset > QSCALE_OFF_MAX)			interval = INTERVAL_QUERY_NORMAL;		else if (abs_offset < QSCALE_OFF_MIN)			interval = INTERVAL_QUERY_NORMAL * (1 / QSCALE_OFF_MIN);		else			interval = INTERVAL_QUERY_NORMAL * (1 / abs_offset);	}	p->next = time(NULL) + interval;	p->deadline = 0;	p->state = STATE_REPLY_RECEIVED;	/* every received reply which we do not discard increases trust */	if (p->trustlevel < 10) {		if (p->trustlevel < TRUSTLEVEL_BADPEER &&		    p->trustlevel + 1 >= TRUSTLEVEL_BADPEER)			log_info("peer %s now valid",			    log_sockaddr((struct sockaddr *)&fsa));		p->trustlevel++;	}	client_update(p);	log_debug("reply from %s: offset %f delay %f, "	    "next query %ds", log_sockaddr((struct sockaddr *)&fsa),	    p->reply[p->shift].offset, p->reply[p->shift].delay, interval);	if (++p->shift >= OFFSET_ARRAY_SIZE)		p->shift = 0;	return (0);}