FreeBSD/contrib/ntp/ntpd/ntp_leapsec.c
/* [internal] Add raw data to the table, removing old entries on the
 * fly. This cannot fail currently.
 */
[internal] Add raw data to the table, removing old entries on the
fly. This cannot fail currently.
[ internal ] Add raw data to the table removing old entries on the fly . This cannot fail currently .
static int
add_range(
	leap_table_t *      pt,
	const leap_info_t * pi)
{
	if (pt->head.size == 0) {
		pt->head.base_tai = pi->taiof - 1;
	} else if (pt->head.size >= MAX_HIST) {
		pt->head.size     = MAX_HIST - 1;
		pt->head.base_tai = pt->info[pt->head.size].taiof;
	}
	memmove(pt->info+1, pt->info, pt->head.size*sizeof(*pt->info));
	pt->info[0] = *pi;
	pt->head.size++;
	reset_times(pt);
	return TRUE;
}
static int add_range ( leap_table_t * pt , const leap_info_t * pi ) { if ( pt -> head . size == 0 ) { pt -> head . base_tai = pi -> taiof - 1 ; } else if ( pt -> head . size >= MAX_HIST ) { pt -> head . size = MAX_HIST - 1 ; pt -> head . base_tai = pt -> info [ pt -> head . size ] . taiof ; } memmove ( pt -> info + 1 , pt -> info , pt -> head . size * sizeof ( * pt -> info ) ) ; pt -> info [ 0 ] = * pi ; pt -> head . size ++ ; reset_times ( pt ) ; return TRUE ; }
[internal] Add raw data to the table, removing old entries on the
 fly.
[ internal ] Add raw data to the table removing old entries on the fly .
/*BOOL*/ /* If the table is full, make room by throwing out the oldest
	 * entry. But remember the accumulated leap seconds! Likewise,
	 * assume a positive leap insertion if this is the first entry
	 * in the table. This is not necessarily the best of all ideas,
	 * but it helps a great deal if a system does not have a leap
	 * table and gets updated from an upstream server.
	 */ /* make room in lower end and insert item */ /* invalidate the cached limit data -- we might have news ;-)
	 *
	 * This blocks a spurious transition detection. OTOH, if you add
	 * a value after the last query before a leap transition was
	 * expected to occur, this transition trigger is lost. But we
	 * can probably live with that.
	 */