Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to use sk time only if there is no other sources available. #6

Closed
FredericGuilbault opened this issue Mar 31, 2019 · 9 comments

Comments

@FredericGuilbault
Copy link
Contributor

In a near future I would like to work on a pull-request witch would add a checkbox option prevent sk from setting the date if chrony have some valid time source.

The point is, sk time seem to be the loosest approch to set time on a *nix machine :

  1. ntp time: 0.050 to 0.100 seconds accuracy
  2. GPS PPS: 0.0001 to 1 seconds accuracy (depend A LOT on the receiver apparently )
  3. sk time : 1 to 2 seconds (if I understand it right).

But it's often the only time source available. So I want to use it as fallback option.

This would be the command that check chrony have valid time input from NTP or GPS PPS :

chronyc sources | cut -c2 | grep -ce '-\|*'

Would it fit in the set-system-time plugin ?

@FredericGuilbault
Copy link
Contributor Author

FredericGuilbault commented Mar 31, 2019

FTR poorman internet time :

date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')"

This could be an other approach that does not depend on having chrony installed and running.

@tkurki
Copy link
Member

tkurki commented Apr 1, 2019

I think it would be useful! For example my setup usually gets ntp time via 4G net connection, but sometimes there is no coverage, like rebooting the system offshore, and then set-system-time is the only feasible option on an N2K system afaik.

It would have to be robust, so that it works even on a minimal system with no chronyc. Naturally then it would not detect other time sources in use, but even then it should work.

How did you end up with 1-2 seconds for sk time? It is just using GPS time, I'd be surprised to get that long delay between GPS sentence and setting the time.

@FredericGuilbault
Copy link
Contributor Author

It's more of an estimation then a benchtest.
But set-system-time is trigered at a round seconds, it read last navigation.datetime witch can be anything between fresh to 1 sec old. and write it in date If you add a bit of processing delay. I guess that in worst odds. you can leap a second twice.

And you can't be under one cuz at T = +0.0000 set-system-time read navigation.datetime data from T < -0.001 and write it at T > 0.001

But if there is no internet connection available. 1 second accuracy Is wayc enough for a sextant :p

@tkurki
Copy link
Member

tkurki commented Apr 1, 2019

trigered at a round seconds

You mean that datetime is being polled once per second? No, the whole process is driven by incoming data: when your server receives RMC NMEA0183 sentence via USB, it is converted to Signal K and the resulting datetime is passed on to the set-system-time. So there is certainly processing delay, but nothing else.

@FredericGuilbault
Copy link
Contributor Author

ah ok, understood.

@FredericGuilbault
Copy link
Contributor Author

PR have been accepted and changes are now in production :D
Closing.

@sailoog
Copy link

sailoog commented Feb 12, 2023

I am afraid this is not working.

After booting chrony sets the correct time from NTP and everything works ok. When SK sets the time chrony detects a forward time jump: "System clock wrong by -2419199.119810 seconds" and this makes some applications like apt not work well. When set-system-time plugin is disabled everything works ok again.

@tkurki
Copy link
Member

tkurki commented Feb 12, 2023

Open a new issue with more details if you think there is something to fix here.

@sailoog
Copy link

sailoog commented Feb 12, 2023

done: #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants