Re: [ntp:questions] How common is LI=3 - solved.

2017-02-06 Thread Hal Murray

> By the way, the code I am writing is not part of a NTP algorithm to adjust a
> system clock for time.  It is for a one-time frequency calibration of an
> oscillator.  I take a time snapshot at the beginning and at the end of an
> approximately six hour period during which I am counting cycles from the
> oscillator in question.  I hope to achieve a frequency accuracy of 5 PPM.
> Once that measurement is made, I store it for subsequent use in my app.
> Unless the hardware changes, there is no need to do the calibration again. 

Why bother with all the packets.  Isn't your PC's clock good enough?

5 PPM over 6 hours is 0.108 seconds.  Unless you have a crappy network 
connection, ntpd should keep your clock within a few 10s of ms.  If we assume 
25 ms measurement error at both start and stop, you only need 3 hours.


-- 
These are my opinions.  I hate spam.



___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How common is LI=3 - solved.

2017-02-06 Thread David Taylor

On 05/02/2017 00:22, Robert Scott wrote:
[]

By the way, the code I am writing is not part of a NTP algorithm to
adjust a system clock for time.  It is for a one-time frequency
calibration of an oscillator.  I take a time snapshot at the beginning
and at the end of an approximately six hour period during which I am
counting cycles from the oscillator in question.  I hope to achieve a
frequency accuracy of 5 PPM.  Once that measurement is made, I store
it for subsequent use in my app.  Unless the hardware changes, there
is no need to do the calibration again.

-Robert Scott
 Hopkins, MN


Robert,

I appreciate it's a one-time calibration, but if anyone needs a stable, 
adjustable frequency source, they might look at the GPS disciplined device:



http://www.leobodnar.com/shop/index.php?main_page=product_info_id=234

--
Cheers,
David
Web: http://www.satsignal.eu

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How common is LI=3 - solved.

2017-02-05 Thread Brian Inglis
On 2017-02-05 02:14, David Woolley wrote:
> On 05/02/17 00:22, Robert Scott wrote:
>> I hope to achieve a frequency accuracy of 5 PPM. Once that
>> measurement is made, I store it for subsequent use in my app.
> The equipment doesn't have a very long service life and is in a
> temperature controlled environment, as I think both ageing and
> thermal effects can violate the 5ppm limit.

I keep my systems running with max performance power profiles to 
avoid internal frequency and temperature variation, which could 
alter drift, and they stay within about +/-1ppm, but after any 
power off, drift jumps ~1ppm, settling down to a new range.

For common XO parts, tolerance and stability are +/-30ppm over 
90C range and aging +/-3ppm/year, say .7ppm/C and 6ppm/year 
worst case, so the environment would need controlled within 3C 
for 5 months, after days of continuous running to stabilize, 
to stay within your limit. 

You could run your calibration until results over the previous 
six hours stabilized, but your calibration would first need 
to run itself against your timing system, to ensure that it has 
stabilized. 

It would need recalibrated any time it was powered off, after 
days of continuous running to stabilize. 

Excessive vibrations could cause the limit to be exceeded at 
any time, as crystals are piezo transducers.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How common is LI=3 - solved.

2017-02-05 Thread David Woolley

On 05/02/17 00:22, Robert Scott wrote:

 I hope to achieve a
frequency accuracy of 5 PPM.  Once that measurement is made, I store
it for subsequent use in my app.


The equipment doesn't have a very long service life and is in a 
temperature controlled environment, as I think both ageing and thermal 
effects can violate the 5ppm limit.


___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How common is LI=3 - solved.

2017-02-04 Thread Robert Scott
On Sat, 4 Feb 2017 10:09:11 +, David Woolley
 wrote:

>On 03/02/17 23:10, Robert Scott wrote:
>>  But with other servers, the first
>> response came back good, the second response came back LI=3, the third
>> and fourth responses never came back at all.  (recvfrom() has to be
>> aborted).
>>
>> Is this possibly a defense mechanism against a DOS attack?
>
>
>See , in 
>particular the section on Kiss-of-Death.  Your code should be 
>recognizing these and raising an alarm.

My code does parse for the Kiss-of-Death codes.  And when it gets it,
it will not query that host again.  But my code checks for LI=3 first,
and if it gets that, it does not check further because my response to
LI=3 is the same as my response to KOD.  I do not query that host
again.  The only reason I was querying those hosts again is because of
the bug in my code that prevented my looping through all four hosts.
So I thought I was accessing a different host when in fact I was
accessing the same host four times.  Since I fixed that bug, I don't
think I will be getting LI=3 very often.  But if I do, I will treat it
the same as the KOD.

By the way, the code I am writing is not part of a NTP algorithm to
adjust a system clock for time.  It is for a one-time frequency
calibration of an oscillator.  I take a time snapshot at the beginning
and at the end of an approximately six hour period during which I am
counting cycles from the oscillator in question.  I hope to achieve a
frequency accuracy of 5 PPM.  Once that measurement is made, I store
it for subsequent use in my app.  Unless the hardware changes, there
is no need to do the calibration again.

-Robert Scott
 Hopkins, MN

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How common is LI=3 - solved.

2017-02-04 Thread David Woolley

On 03/02/17 23:10, Robert Scott wrote:

 But with other servers, the first
response came back good, the second response came back LI=3, the third
and fourth responses never came back at all.  (recvfrom() has to be
aborted).

Is this possibly a defense mechanism against a DOS attack?



See , in 
particular the section on Kiss-of-Death.  Your code should be 
recognizing these and raising an alarm.


___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How common is LI=3 - solved.

2017-02-03 Thread Robert Scott
On Fri, 03 Feb 2017 03:15:09 GMT, no-one@notreal.invalid (Robert
Scott) wrote:

>I am writing some parsing code for reading Time Server packets.  The
>first 32 bits of the returned packet are:
>
>+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>|LI | VN  |Mode |Stratum| Poll  |   Precision|   
>+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   
>
>When the two LI bits come back as 11 (clocks not synchronized) I have
>been treating that as a fatal error for that server.  I ignore that
>packet and do not attempt to retry my query for that server.  However
>I have found that LI=11 is not all that uncommon for servers from the
>pool.  Is my response to LI=11 the correct one?  Should I discard the
>response and should I write off that server for retries?  So far, the
>only reason I might retry a server is if my recvfrom() socket call
>times out.
>
>-Robert Scott
> Hopkins, MN
>

I think I found a bug in my software that was causing this.  I was
fetching four IP addresses from pool.ntp.org just fine, but I was
mistakenly always accessing just the first one of those IP addresses
when I thought I was looping through all four.  The result is I was
trying to hit the same server four times in quick succession.  With
some servers this worked fine.  But with other servers, the first
response came back good, the second response came back LI=3, the third
and fourth responses never came back at all.  (recvfrom() has to be
aborted).

Is this possibly a defense mechanism against a DOS attack?  In any
case I only did it a few times before I found my error.  A big clue
was that the responses from all four hosts had the same stratum.
Sometimes 2, sometimes 3.  Now I get a mixture of strata in the four
hosts so I know I am quering each host only once.

-Robert Scott
 Hopkins, MN

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions