/* If we have an externally synchronized linux clock, then update CMOS clock accordingly every ~11 minutes. set_rtc() has to be called as close as possible to 500 ms before the new second starts.  */
static void do_set_rtc(void)
/* If we have an externally synchronized linux clock, then update CMOS clock accordingly every ~11 minutes. set_rtc() has to be called as close as possible to 500 ms before the new second starts.  */
static void do_set_rtc(void)
{
	if (!ntp_synced() || set_rtc == NULL)
		return;
	if (next_rtc_update &&
	    time_before((unsigned long)xtime.tv_sec, next_rtc_update))
		return;
	if (xtime.tv_nsec < 500000000 - ((unsigned) tick_nsec >> 1) &&
	    xtime.tv_nsec >= 500000000 + ((unsigned) tick_nsec >> 1))
		return;
	if (set_rtc())
		next_rtc_update = xtime.tv_sec + 60;
	else
		next_rtc_update = xtime.tv_sec + 660;
}