[ntp:questions] Garmin LVC 18x jitter problem

Jakob Bohm jb-usenet at wisemo.com.invalid
Sat Aug 10 10:09:32 UTC 2019


Minor issue 1: You seem not to initialize fudgeminjitter if not
configured.  Probably to 0.0

Wishlist issue 2: Maybe also make fudgeminjitter available for network
clocks, e.g. to describe a non-uniform packet jitter in a network path
or non-uniform hardware jitter in a preferred site local higher stratum
server.

On 10/08/2019 08:58, Michael Haardt wrote:
> By now I hacked ntpd for allowing to override the lower jitter bound,
> which fixes the problem properly.  The attached patch shows the current
> state.
> 
> Good: It works! ntpd no longer drops the GPS as false ticker, which in
> turn does not drop PPS that depends on the preferred peer, so everything
> works as beautiful as with "tos mindist 0.1", but without the negative
> effect on the root dispersion that is caused by increasing the minimum
> distance.
> Bad: I don't see the modified jitter with "ntpq -c peers" and I have
> no idea why.  I verified it is modified.  Perhaps there is duplicated
> code somewhere I missed to modify as well? I should add a flag, but that
> would run out of bits, and I am not certain if I may need to change other
> struct members or variables storing flags as well, because much data is
> being copied instead of referenced.  I would appeciate some help here.
> 
> IMHO the minimum distance should only be set in case of multiple
> reference clocks that unfortunately have no overlap of offset and jitter,
> so increasing the distance allows to use them at the logical price of a
> higher root dispersion.  Using it to fix the wrong jitter estimation of
> a single clock with not statistically distributed jitter is not what it
> is intended for.  Overriding the jitter of that clock is what is really
> required, and checking past mailing lists, this topic came up quite a
> few times.  Obviously that allows to set mindist to 0, which reduces
> the root dispersion to the actual value, which is below 1 ms for me.
> 
> Michael
> 
> diff -u -r ntp-dev-4.3.99-orig/ntpd/ntp_refclock.c ntp-dev-4.3.99/ntpd/ntp_refclock.c
> --- ntp-dev-4.3.99-orig/ntpd/ntp_refclock.c	2019-06-07 09:42:47.000000000 +0200
> +++ ntp-dev-4.3.99/ntpd/ntp_refclock.c	2019-08-07 19:17:08.947049304 +0200
> @@ -494,6 +494,7 @@
>   	}
>   	pp->offset /= m;
>   	pp->jitter = max(SQRT(pp->jitter / m), LOGTOD(sys_precision));
> +	pp->jitter = max(pp->jitter, pp->fudgeminjitter);
>   #ifdef DEBUG
>   	if (debug)
>   		printf(
> @@ -1080,6 +1081,7 @@
>   			pp->sloppyclockflag &= ~CLK_FLAG4;
>   			pp->sloppyclockflag |= in->flags & CLK_FLAG4;
>   		}
> +		pp->fudgeminjitter = in->fudgeminjitter;
>   	}
>   
>   	/*
> diff -u -r ntp-dev-4.3.99-orig/include/ntp_refclock.h ntp-dev-4.3.99/include/ntp_refclock.h
> --- ntp-dev-4.3.99-orig/include/ntp_refclock.h	2016-03-27 23:59:49.000000000 +0200
> +++ ntp-dev-4.3.99/include/ntp_refclock.h	2019-08-07 19:07:13.902963553 +0200
> @@ -81,6 +81,7 @@
>   	double	fudgetime2;	/* configure fudge time2 */
>   	int32	fudgeval1;	/* configure fudge value1 */
>   	u_int32	fudgeval2;	/* configure fudge value2 */
> +	double	fudgeminjitter;	/* configure fudge minjitter */
>   	u_char	currentstatus;	/* clock status */
>   	u_char	lastevent;	/* last exception event */
>   	u_char	leap;		/* leap bits */
> @@ -176,6 +177,7 @@
>   	 */
>   	double	fudgetime1;	/* fudge time1 */
>   	double	fudgetime2;	/* fudge time2 */
> +	double	fudgeminjitter;	/* manually set lower bound for jitter */
>   	u_char	stratum;	/* server stratum */
>   	u_int32	refid;		/* reference identifier */
>   	u_char	sloppyclockflag; /* fudge flags */
> diff -u -r ntp-dev-4.3.99-orig/ntpd/keyword-gen.c ntp-dev-4.3.99/ntpd/keyword-gen.c
> --- ntp-dev-4.3.99-orig/ntpd/keyword-gen.c	2019-06-07 05:54:31.000000000 +0200
> +++ ntp-dev-4.3.99/ntpd/keyword-gen.c	2019-08-06 19:54:05.362952788 +0200
> @@ -199,6 +199,7 @@
>   { "stratum",		T_Stratum,		FOLLBY_TOKEN },
>   { "time1",		T_Time1,		FOLLBY_TOKEN },
>   { "time2",		T_Time2,		FOLLBY_TOKEN },
> +{ "minjitter",		T_Minjitter,		FOLLBY_TOKEN },
>   /* system_option */
>   { "auth",		T_Auth,			FOLLBY_TOKEN },
>   { "bclient",		T_Bclient,		FOLLBY_TOKEN },
> diff -u -r ntp-dev-4.3.99-orig/ntpd/ntp_config.c ntp-dev-4.3.99/ntpd/ntp_config.c
> --- ntp-dev-4.3.99-orig/ntpd/ntp_config.c	2019-06-07 10:59:13.000000000 +0200
> +++ ntp-dev-4.3.99/ntpd/ntp_config.c	2019-08-07 19:04:12.254768986 +0200
> @@ -3703,6 +3703,13 @@
>   					clock_stat.flags &= ~CLK_FLAG4;
>   				break;
>   
> +			case T_Minjitter:
> +#if 0
> +				clock_stat.haveflags |= CLK_HAVEMINJITTER;
> +#endif
> +				clock_stat.fudgeminjitter = curr_opt->value.d;
> +				break;
> +
>   			default:
>   				msyslog(LOG_ERR,
>   					"Unexpected fudge flag %s (%d) for %s",
> diff -u -r ntp-dev-4.3.99-orig/ntpd/ntp_parser.y ntp-dev-4.3.99/ntpd/ntp_parser.y
> --- ntp-dev-4.3.99-orig/ntpd/ntp_parser.y	2019-06-07 09:42:47.000000000 +0200
> +++ ntp-dev-4.3.99/ntpd/ntp_parser.y	2019-08-06 19:55:06.822342155 +0200
> @@ -170,6 +170,7 @@
>   %token	<Integer>	T_Mindepth
>   %token	<Integer>	T_Mindist
>   %token	<Integer>	T_Minimum
> +%token	<Integer>	T_Minjitter
>   %token	<Integer>	T_Minpoll
>   %token	<Integer>	T_Minsane
>   %token	<Integer>	T_Mode
> @@ -1024,6 +1025,7 @@
>   fudge_factor_dbl_keyword
>   	:	T_Time1
>   	|	T_Time2
> +	|	T_Minjitter
>   	;
>   
>   fudge_factor_bool_keyword
> diff -u -r ntp-dev-4.3.99-orig/ntpd/refclock_parse.c ntp-dev-4.3.99/ntpd/refclock_parse.c
> --- ntp-dev-4.3.99-orig/ntpd/refclock_parse.c	2019-06-07 10:59:13.000000000 +0200
> +++ ntp-dev-4.3.99/ntpd/refclock_parse.c	2019-08-07 19:09:52.371388507 +0200
> @@ -3424,6 +3424,8 @@
>   #endif
>   		    }
>   		}
> +
> +		parse->generic->fudgeminjitter = in->fudgeminjitter;
>   	}
>   }
>   
> 


Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded



More information about the questions mailing list