[time-nuts] Re: Clock display on Linux systems?

Attila Kinali attila at kinali.ch
Mon Dec 6 20:34:54 UTC 2021


On Sun, 5 Dec 2021 15:53:57 -0500
Adam Space <time.isanapp at gmail.com> wrote:

> For example,
> the only solutions in Python (which I would prefer to use if possible, but
> not necessary)

I would advise against using python for something like this.
time.sleep() of python is extremely inaccurate. For long
sleep times (a few hours), it's off by 10-20s, and for
short sleep times(1-60s) it's still off by up to 10%.
I don't know what they are doing there, because the sleep
systemcall does not exhibit this problem and neither does any
other language I used in the past have that problem. 
Not perl, not raku, not java, and definitely not C.
While being off by a few 10s of ms will not be noticable,
if you are off by 100s of ms, that gets noticable when
you have a clock to compare to. And if it gets really
bad, you get even a Vetinary clock.

If you are not averse to C++ I would recommend the Qt
examples:
https://doc.qt.io/qt-5/qtwidgets-widgets-digitalclock-example.html
https://doc.qt.io/qt-5/qtwidgets-widgets-analogclock-example.html
and build on them.

Alternatively, allmost any GUI library for any language contains
a clock example that you could modify.

			Attila Kinali

-- 
The driving force behind research is the question: "Why?"
There are things we don't understand and things we always 
wonder about. And that's why we do research.
		-- Kobayashi Makoto




More information about the Time-nuts_lists.febo.com mailing list