[time-nuts] Re: Clock display on Linux systems?
Tom Van Baak
tvb at LeapSecond.com
Mon Dec 6 20:06:16 UTC 2021
Hi Adam,
It would help to know, numerically, what you're goals or requirements
are. But it sounds like you're not interested in microseconds or
nanoseconds, maybe just milliseconds?
There are untold number of layers of latency in the system you describe,
especially since you're using a general purpose computer, a general
purpose operating system, a general purpose language, general purpose
display, etc.
But two ideas come to mind.
1) One way to reduce latency is to have your clock display include
pixels that flash once a second and monitor that portion of the display
using a phototransistor. Then compare that pulse to a GPS/1PPS pulse and
steer your software delays for zero mean. Not only will it reduce the
latency caused by executing millions of lines of code in the computer
and inside the display but it will also solve bias and latency issues in
NTP.
In fact, as long as you can set the clock once, you don't need NTP at
all. The display will be locked to GPS. The only remaining latency is 1
ns per foot for the photons to reach your eye and the hundreds of
milliseconds it takes for your eye and brain to process the image. ;-)
2) For higher precision the other solution is not use general purpose
computing as a source of time or display. Instead use logic IC's or
microcontroller to direct drive LED digits. Do not multiplex the digits
or segments. In theory this would get you down to the turn-on time for
an LED, which is likely very sub-microsecond.
Decades ago this would be done with an attractive chain of 7400-series
TTL or 4000-series CMOS chips with 7-segment LED's. You could make a
13-digit display (HH:MM:SS.mmmuuun) clocked at 10 MHz from a GPSDO.
To summarize, the solution(s) you choose very much depend on the
precision of the timing you require.
/tvb
On 12/5/2021 12:53 PM, Adam Space wrote:
> Most distributions of Linux already have a "clock" application that shows
> the system time, but I am wondering how to program a more customizable
> display on a Linux system / Raspberry pi. There are a few solutions that
> pop up by googling the issue, but these are all insufficient. For example,
> the only solutions in Python (which I would prefer to use if possible, but
> not necessary) I have found are 1) using a library like pygame or tkinter
> to build a display or 2) doing something more barebones like displaying the
> time and sleep() ing for a second. 1) is terribly inefficient for a display
> of accurate time, because either you have a refresh rate that is low and
> the clock updates with significant lag, or you have a high refresh rate
> which eats up large processing power. 2) is also inefficient because the
> frequency of a local clock may be poor, so long term accuracy can only be
> sustained with synchronization via NTP for example.
>
> Perhaps there are lower level Linux commands that could be used for this?
> I'm not sure. Any suggestions are welcome.
>
> Adam
>
More information about the Time-nuts_lists.febo.com
mailing list