Skip to content

Improvement suggestions #7

@Lefuneste83

Description

@Lefuneste83

Hello

Thank you for your help in setting up this nice solution.

I have implemented most of your code for the LCD output of the chronyc status, and everything works as expected. I have a few remarks.

-In latest Linux distributions, in particular on Debian 12, you cannot "pip install" a package system wide anymore in standard.
You must restrict the installation of python packages to a venv. The proposed way to circumvent this is to use pipx to install packages system wise, but pipx only accepts programs pacakges, not libraries (which is the case for gpsd-py3 and smbus).
So the only possible solution is to manually delete the file "EXTERNALLY-MANAGED" located in /usr/lib/python3.xx/.
Considering that this venv constraint will be more and more widespread as systems get updated, you should consider updating your installation documentation.

-Considering the display itself, I believe it would be useful to replace some static information which takes some room, or to switch the content of a line every once in a while, in particular for one missing very important information, which is the STRATUM status of the server.
If you have a synchronization issue of any kind (like a process unable to access SHM) your server can be degraded to a higher stratum level without any notice. It will still serve time internally on your LAN, but as a lower grade reference. So I believe it would be nice to have the current stratum level directly displayed as well.

I have fiddled with the code that would allow this, but haven't been successful in doing so. It would be nice to complete this ntp_offset() function to parse the stratum level as it processes the chronyc tracking output.
You could then alternate the second line of the display every 5 seconds or so with NTP: X.XXXXXXXXXsec / Stratum level : X
Or any other useful info such as RMS offset and Frequency, both of which have a slow evolution and have some level of importance.
Sorry I am not good enough in Python to work this out myself and also it would be valuable for the community.

Thanks!

Snipet of the current function below

def ntp_offset():
    cmd = ["chronyc", "tracking"]
    ret = exec_cmd(cmd)
    for line in ret:
        pars = line.split(":", 1)
        if len(pars) == 2:
            if pars[0].strip() == "System time":
                sub_pars = pars[1].strip().split(" ")
                if len(sub_pars) > 2:
                    val = float(sub_pars[0])
                    if "slow" == sub_pars[2]:
                        val = -1.0 * val
            return "NTP: {:+12.9f}sec".format(val)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions