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

How to get the NTP Synchronized status only ? #7

Closed
davidyang429 opened this issue Aug 24, 2020 · 1 comment
Closed

How to get the NTP Synchronized status only ? #7

davidyang429 opened this issue Aug 24, 2020 · 1 comment

Comments

@davidyang429
Copy link

I want to get the NTP Synchronized status by this api .

l want to find a command that can show the machine readable attribution for which is like a constant string or number no matter in other Debian version .

My linux version : Debian 9

image

@cf-natali
Copy link
Owner

Hi @davidyang429 ,

ntplib is designed to be an implementation of the ntp protocol.
But this ntp synchronised status is not part of the ntp protocol, it's implemented by the ntp client/daemon, and is actually quite complex (dealing with outliers, etc).
So there is no access to this status from ntplib - which queries a single server btw.

Depending on what you are trying to achieve, you might get away which just checking that the offset is lower than an hard-coded threshold but it's probably fragile: I guess that if you just want this status you might have to query whatever client your machine is using.

Cheers,

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

2 participants