[chrony-dev] apply_step_offset() in sys_macosx.c

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


I am reading the code of apply_step_offset() in sys_macosx.c and have some problems understanding it.

Especially these lines:

struct timeval T1;	
UTI_AddDoubleToTimeval(&T0, offset, &T1);	//	← I think this should be rather “-offset”
T0 = T1;

For example:

apply_step_offset( offset = 10 minutes ) gets called on 12:17:00
	stop_adjust() sets T0 = 12:17:01	(this is a very slow example)
	old_time = 12:17:02
	new_time = 12:07:02	//	new_time = old_time - offset
	settimeofday( 12:07:02 )
	T0 = 12:27:01	//	T0 += offset
	
	start_adjust does:
		T1 = 12:07:03
		elapsed = T1 - T0 = 12:07:03 - 12:27:01 = -20 minutes + 2 seconds
		accrued_error = current_freq * (almost -20 minutes)

This I guess is not quite right.
With “-offset” the accrued error would be current_freq * 2 seconds, which makes more sense to me.

But maybe I just don’t understand the code correctly.


Kind regards,

Gerriet.
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/