/* The time is "clock". old is what we think the time is. Adjust the value by a multiple of jiffies and add the delta to ntp. "delay" is an approximation how long the synchronization took. If the time correction is positive, then "delay" is subtracted from the time difference and only the remaining part is passed to ntp.  */
static unsigned long long adjust_time(unsigned long long old, unsigned long long clock, unsigned long long delay)
/* The time is "clock". old is what we think the time is. Adjust the value by a multiple of jiffies and add the delta to ntp. "delay" is an approximation how long the synchronization took. If the time correction is positive, then "delay" is subtracted from the time difference and only the remaining part is passed to ntp.  */
static unsigned long long adjust_time(unsigned long long old, unsigned long long clock, unsigned long long delay)
{
	unsigned long long delta, ticks;
	struct timex adjust;
	if (clock > old) {
		delta = ticks = clock - old;
		delta = ticks = (delta < delay) ? 0 : delta - delay;
		delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
		adjust.offset = ticks * (1000000 / HZ);
	} else {
		delta = ticks = old - clock;
		delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
		delta = -delta;
		adjust.offset = -ticks * (1000000 / HZ);
	}
	sched_clock_base_cc += delta;
	if (adjust.offset != 0) {
		pr_notice("The ETR interface has adjusted the clock "
			  "by %li microseconds\n", adjust.offset);
		adjust.modes = ADJ_OFFSET_SINGLESHOT;
		do_adjtimex(&adjust);
	}
	return delta;
}