libsodium mess

Kurt Roeckx kurt at roeckx.be
Fri Jan 20 00:51:23 UTC 2017


On Thu, Jan 19, 2017 at 02:40:08PM -0800, Gary E. Miller wrote:
> > > I'm worried about 1 micro Second or less.  And one should not
> > > confuse accuracy with resolution.  A PPS signal only has a
> > > resolution of one Second, but can eaaily have an accuracy of 10
> > > nano seconds.  
> > 
> > Please don't confuse accuracy with precision. I'm not sure your 10
> > nano seconds is the accuracy or precision, both are possible, but
> > I think you're talking about precision. The accuracy is probably
> > not that easy to measure.
> 
> You are right, I probably should have said the resolution of the PPS is
> just one second That PPS just fires once a second.  There is no way to
> tall anything about anything, except that one moment in time at the top
> of the second.
> 
> I tend to use precision interchangeabley with resolution.

They're clearly different things.

> The number of significant digits past the second is zero.
> 
> If you doubt a PPS is accurate to 10 nano Seconds then head over to
> time-nuts.  They'll give you an earfull.  I'm happy just to know that
> the ACCURACY of when the PPS pulse happens is quoted as 10 nano Seconds
> on the data sheets of many GPS.  Other GPS only claim 1 micro Second.

Please note that I say both precision and accuracy is possible.
But it's not because they have the time to such accuracy that they
can output it with such accuracy, or that you can measure it with
such an accuracy.

I was under the impression that you said you could sync your clock
to 10 ns using PPS, but I guess I misunderstood that.

> > > A signal on a USB 2.0 bus can only have a resolution of about 1
> > > micro Second, but that can be locked to a PPS to 100 micro Seconds
> > > jitter.  
> > 
> > I'm not sure what you're trying to say.
> 
> Each USB 2.0 device is polled 1024 times a second.  So you would think
> you could only sync time over a USB 2.0 bus to 1/1024th of a second.
> About 1 micro Second.  But that is not true, you can sync time over USB
> 2.0 to 100 microseconds.

1/1000 of a second would 1 millisecond, not microsecond.

> If you said the resolution is only 1 micro second, and you added
> 500 micro Seccond of jitter, you would make the sync 5 times worse,
> not better.

You seem to be confusing milli with micro again, I'm going to
assume the first is milli.

I guess you're saying:
- I can read about every 1 ms
- But there is jitter on that 1 ms in the order of 0.002 to 0.1 ms
- You could add an other random 0.5 ms in software.

First, even though the PPS signal is only once per second, you're
really measuring the pulse, and you could say you're measuring that
with a resolution of 1 ms.

But your problem is that you probably have no idea what the
distribution is of your 0.1 ms jitter, and if you have no idea what
it is you can't properly correct for it, and you probably make
things worse.

Adding the 0.5 to the 0.1 ms would probably give something in the
order of 0.6 ms, and would probably end up better like a normal
distribution, which is what you want. But in the end the you're not
going to get much better than the 0.1 ms.

Adding noise here after the measurment really doesn't make sense
to me. You would instead need to modify the output of the PPS
signal to add random jitter to it, so that it doesn't always
happen every 1024 polls. That is assuming you now almost always
get it every 1024 polls. If you make sure that you get different
numbers you can average it and get something better then your 1 ms.
But I'm not sure this is actually useful. You probably want to
have a signal of more than 1 Hz for something like that.

> > But if you're talking about jitter, you're really talking about
> > the precision.
> 
> NTP uses yet another definition for precision, so it is confusing.  NTP
> calculates precision from jitter.  NTP precision (not accuracy) is
> assumed to be slightly worse than the jitter.  The NTP precision can be
> no better than the jitter.  Conversly the NTP jitter is better than
> the precision.

NTP uses the smallest difference in time the program can see
as precision, which is at least confusing. Precision is about how
repeatable something is.


Kurt



More information about the devel mailing list