New information about clock fuzzing

Eric S. Raymond esr at thyrsus.com
Wed Jan 25 11:47:21 UTC 2017


Hal Murray <hmurray at megapathdsl.net>:
> 
> esr at thyrsus.com said:
> > (1) A way to hoist some code out of the time-setting critical path in
> >     step_systime() 
> 
> There is nothing critical in there - unless you using a different meaning 
> than I'm thinking of.
> 
> That code is essentially never used.
> 
> You might have found a way to make it easier to read and understand.  That 
> would be good.

After line 372:

	/* ---> time-critical path starts ---> */

	/* get the current time as l_fp (without fuzz) and as struct timespec */
	get_ostime(&timets);
	fp_sys = tspec_stamp_to_lfp(timets);

	/* get the target time as l_fp */
	fp_sys += fp_ofs;

	/* unfold the new system time */
	timets = lfp_stamp_to_tspec(fp_sys, &pivot);

	/* now set new system time */
	if (settime(&timets) != 0) {
		msyslog(LOG_ERR, "step_systime: %m");
		return false;
	}

	/* <--- time-critical path ended with call to the settime hook <--- */

	/* only used for utmp/wtmpx time-step recording */
	tslast.tv_sec = timets.tv_sec;
	tslast.tv_nsec = timets.tv_nsec;

The last two lines, of instrumentation, used to be inside the critical
section.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


More information about the devel mailing list