rascol / Raspberry-Pi-PPS-Client

Microsecond PPS time synchronization client for Raspberry Pi.
GNU General Public License v2.0
31 stars 6 forks source link

Independance? #1

Closed Canoe001 closed 6 years ago

Canoe001 commented 6 years ago

Would this feature be possible?

Would it be difficult to have an option to have PPS-Client do its task of disciplining system time to TOS (top of second) from a PPS signal, but while running independently:

Workable?

rascol commented 6 years ago

Short answer: yes the feature is possible.

Long answer: There is no special reason to use NPT to set the whole-second time of day. It was just that it was convenient to use it. The only requirement is that periodically whatever is providing the time of day should be queried for the current time and then the difference in seconds, (provider_time - clock_time) if there is a difference, should update the system clock. Updates are necessary to account for local time changes caused by daylight savings time and leap seconds.

As I recall, making direct changes to the system clock externally to PPS-Client caused some problems because the parts of NPT that are embedded in the kernel prevent slews to a new time of day of more than 500 microseconds each second. I got around this by making the correction through its kernel driver below the NTP code. I don't know whether doing external time settings is still an issue in later Linux kernels. I haven't looked at the code in more than a year so before before committing to a code revision I will have to investigate this again.

What do you have in mind for setting the whole second time of day?

Ray

------ Original Message ------ Received: 02:06 PM EST, 11/23/2017 From: Canoe001 notifications@github.com To: rascol/Raspberry-Pi-PPS-Client Raspberry-Pi-PPS-Client@noreply.github.comCc: Subscribed subscribed@noreply.github.com Subject: [rascol/Raspberry-Pi-PPS-Client] Independance? (#1)

Would this feature be possible?

Would it be difficult to have an option to have PPS-Client do its task of disciplining system time to TOS (top of second) from a PPS signal, but while running independently:

Workable?

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rascol/Raspberry-Pi-PPS-Client/issues/1

Canoe001 commented 6 years ago

But all of the above is just thoughts without my knowing anything about the internal workings of PPS-Client.

Michael

Canoe001 commented 6 years ago

Well that was a lot easier than I thought it would be. Install happened like the documentation said. Running pss-client would exit as it wouldn't find NTP. In pps-client.cpp, I commented out the check for NTP and disabling/re-enabling NTP. I was able to rebuild the installer. pps-client runs and -v runs. Lady Heather is running too, producing nice skymaps.

I didn't pay attention to exactly when, but around ten minutes in:

At the 1023 mark it displayed "sh: 1: ntpq: not found" At 1024 it displayed: "Number of server addresses: 0" "Starting a time check." Nothing appeared to happen and status messages continued as they had. At 2048 it displayed: "Starting a time check." No discernible activity from this. Same message displays roughly every additional 1000 seconds. So I have no idea if the above indicates anything is 'broken', but it appears to get past those checks and the status 'printout' seems to indicate that it is successfully disciplining System Time to TOS from the PPS. I have no idea if the holdover behaviour will do what I need.

To test for stability, I gave the heatsinks on the Pi 3 a moderate blast of canned air. Jitter jumped up to 50 to 54. As jitter started to drop back, clamp jumped to 4. Over a few minutes jitter falls back to single digit, then clamp slides back to 1 while the jitter returns to low single digit values.

After running overnight:

To ensure it's doing what I expect, I'm going to have to turn the logging on. Then I can look back at the pps-client corrections during the periods that Lady Heather's graphs show the GPS accuracy jumped from sub 12 ns (typically 6 to 8 ns) to 30 ns to 50 ns during periods of low sat count or low sat signal (I have less than half a skyview and multipath).

It's a rude and crude mod as it doesn't take any consideration of what/how pps-client is working, but PPS-Client appears to be doing the main job of disciplining System Time to TOS from the PPS. Certainly better than I'd ever dreamed would be possible on a Pi 3.

Michael

rascol commented 6 years ago

OK. I revised the code over the weekend to allow pps-client operate without NTP by setting a command in the /etc/pps-client.conf file. Any program will be able to set the system time of day exactly as originally requested. It will take a few days to a week to look for unforeseen problems and to update the docs.

BTW, I'm happy you were able to get ops-client up and running. From what you described, so far so good. The time checks you observed will disappear when NTP is disabled.

Ray

Canoe001 commented 6 years ago

Nice. I had my copy of the code working with a command line argument, but in conf is much cleaner.

Time issues are fairly new to me, so I'm operating from partial understanding. It is very interesting, the co-ordinating with the kernel when there is external disciplining by PTP or pps-client, etc.. I'm still wrapping my head around that with using NTP as client-server vs. server-only, related holdover behaviour and what NTP/NTPsec will do when using a refclock of local with/without other refclocks.

This morning Lady Heather showed me how my sat count was down to one for 95% of an hour and a half period last night as a new sat would come into my skyview just before the last one would leave. The NEO-M8T provided a timing solution throughout, but there were some accuracy spikes. PPS-Client just pulsed along, keeping the Pi in line with ease. Love it!

Thank you very much for PPS-Client.

Michael

rascol commented 6 years ago

The revisions have been made. When you have had a chance to try out the new code, if there are no issues, I will close this issue.

Ray

Canoe001 commented 6 years ago

Sounds great. My internet has been tragically slow since Saturday. As soon as it can download files without timing out, I'll install and test. (driving me nuts... even times out on sending/receiving email)

rascol commented 6 years ago

Been there. No hurry.

rascol commented 6 years ago

I'm going to close this issue. The code has come a long way since this issue was opened. I'm convinced that the request was satisfied. If there are any further difficulties, raise a new issue.

Ray