1
$\begingroup$

I was learning about the time drift set and correct features of JS8Call and wondering about an alternative.

Assume I have a wrist watch that loses 1 second a month and that it's been sync-ed to an NTP server manually within 500 ms or better.

Is there a program for Linux that allows one to manually sync the computer time to a watch ?

I imagine this would require knowing the lag from the user input to the actual time update.

Perhaps this question is not on topic. I didn't know where else to ask.

$\endgroup$
13
  • 1
    $\begingroup$ I'm not sure this is on-topic for ham.SE. Time synchronization is well-understood and well-discussed on other SEs, and arguably amateur digital modes are probably one of the least critical part of why time sync even exists. The short answer is if you need super high accuracy, you need to run some sort of time server but also have a local reference. The hardware and tools for this are all available on Linux. You can synchronize almost any device if it knows how to synchronize, but something like watch should set itself when it connects to a network. $\endgroup$
    – user21417
    Commented May 23, 2022 at 20:02
  • 1
    $\begingroup$ Make sure you clarify what you want in the question with an edit. For example, I don't know what "SHT" is, so you should mention that and tell us what it means. And i don't quite get what you mean about "no GPS or NTP" when you mention NTP in the question. Upon re-reading it sounds like you want to set the Linux clock by hand based on looking at a watch (Linux isn't going to read a watch for you). If so, search "time set manual linux" and you are done. But NTP or Chrony will work and isn't tremendously difficult to setup. $\endgroup$
    – user21417
    Commented May 23, 2022 at 20:16
  • 1
    $\begingroup$ phoenixnap.com/kb/… contains all the details necessary for setting the clock by hand on a systemd based system. $\endgroup$
    – user21417
    Commented May 23, 2022 at 20:18
  • 1
    $\begingroup$ adjtimex might work $\endgroup$
    – user10489
    Commented May 23, 2022 at 23:42
  • 1
    $\begingroup$ Use the adjtimex command, not the system call! It already has all the adjustments built in. $\endgroup$
    – user10489
    Commented May 24, 2022 at 5:17

3 Answers 3

4
$\begingroup$

Yes. Chrony is an NTP client which is particularly good at offline behavior (better than ntpd in this regard, and infinitely better than systemd-timesyncd, which is only an SNTP client and not a true NTP client at all). It will generally do a better job of maintaining sync for a machine that is only periodically connected to a network.

For the case of an extended period with no network connectivity (or GPS), chrony has a "manual" mode which can be entered using chronyc manual on, and then at any point you can give it a time hack using chronyc settime (see the docs for more info). Rather than stepping the system clock directly, this does the same kind of smooth adjustment that NTP does, and multiple readings can be used to adjust the system clock drift. This is similar to adjtimex --watch but there are some advantages to having it be in the same program that does your NTP when you're on the network.

And adding some amateur radio relevance: the best source of time for manual entry in many parts of the world if you're doing JS8 is, of course, not your wristwatch, but a radio time signal like WWV, WWVH, CHU, RWM, or BPM. As long as you can hear one, you don't have to worry about it gaining or losing time like your wristwatch.

$\endgroup$
6
  • $\begingroup$ Super helpful, thank you. Been meaning to learn about radio time signals, I think that is the only solution for no GPS. $\endgroup$
    – wbg
    Commented May 29, 2022 at 5:02
  • $\begingroup$ @wbg you're a prepper. It's very likely signals like WWVH will disappear first. in fact, they're mostly obsolete already, and a lot of such signals have been switched off. GPS can survive a lot of nuclear winter, before all control centers have failed. $\endgroup$ Commented Jun 8, 2022 at 19:47
  • $\begingroup$ If anything the government makes is truly radiation hardened I'll be impressed...but since I don't want to live through nuclear winter I'd say it's a non-issue. I'm more concerned about civil hostilities. Having multiple time sources sounded like a good idea and maybe fun to pursue for educational purposes. As usual the "experts" have taken the joy out of it. $\endgroup$
    – wbg
    Commented Jun 8, 2022 at 23:29
  • $\begingroup$ @wbg GPS literally is designed to survive a first wave of nuclear attacks. Important part of its job is to help the US retaliate in that case. $\endgroup$ Commented Jun 9, 2022 at 15:45
  • $\begingroup$ I understand that. I'm just not so sure that anything in space can be shielded against gamma rays unless they use those funny micro-tube designs. I suppose it depends on how close the source of radiation is assuming it spreads in a solid-angle. I've been around gamma sources and the shielding is thick lead although that was very close. But in a vacuum I don't think photons are going to loose much energy. I'm pretty sure that ICBM's and modern submarine launched missiles have their own onboard guidance. It's not like they need pin point accuracy. US stockpiles probably don't even work anymore. $\endgroup$
    – wbg
    Commented Jun 9, 2022 at 17:35
2
$\begingroup$

You don't need accurate time for FT8, just time to approx. the nearest half second to any of any 0, 15, 30, or 45 second mark.

If you look at the computer clock display with a second hand, and the waterfall in high enough time resolution, you can see how far off you. Then manually adjust the clock so that one of 0,15,30,45 displays on the clock shows just before you see fresh stripes on the FT8 waterfall.

$\endgroup$
1
  • $\begingroup$ Thanks for the clarification that makes sense. The time drift correct features are probably more than enough. I did install adjtimex and it's a neat program and has a manual --watch option where you can press a key then enter the time at the key press. $\endgroup$
    – wbg
    Commented May 24, 2022 at 15:23
-2
$\begingroup$

that it's been sync-ed to an NTP server manually within 500 ms or better.

NTP is much better, +- 5ms is not even ambitious. So, systemd-timesyncd will do wonders!

You'll want to edit /etc/systemd/timesyncd.conf to set PollIntervalMaxSec= to something reasonable (I'd recommend not going below 120 s). Then, you can activate the service using systemctl enable --now systemd-timesyncd and it will keep your system clock within a few milliseconds of UTC.

(some distros use chronyd instead, same general idea applies, but different config file, and the service is called chronyd instead of systemd-timesyncd.)

But, to come back to your original question:

Assume I have a wrist watch that looses 1 second a month

That's a 0.39 ppm wrist watch. You don't have a 0.39 ppm wrist watch; for such applications, 15 ppm oscillators are more the order in which one moves.

< 1 ppm is oven-controlled oscillator domain, not wristwatch domain, for power reasons. Technically, when you need such precision for a compute/communication system, and it's not underground or to be deployed above 10 km, or in a war zone where that might be disabled, you'd go for a GPS receiver instead. These are commonly available with a Pulse-Per-Second output, and you can read the time at the last pulse from the NMEA strings read from the serial port of the receiver.

Now, you might find yourself in a submarine without access to the sky (but to FT-8? OK!) and need a good clock and time source. Then you'd use a good oven-controlled oscillator to generate e.g. a 2²⁰ Hz clock, or even an atomic clock. You count the seconds according to that clock, and whenever someone whose clock you trust comes by (i.e., someone with a GPS with an OCXO in holdover, your wristwatch's 15ppm paired with the natural 1s resolution is so bad that you stand a fair chance to make things worse, not better), you use a (very slow) control loop to adjust your clock. That way, you train it to be as true as it can long-term be to "real" time.

Is there a program for Linux that allows one to manually sync the computer time to a watch ?

You could write your own few python lines of Python or C or C++ code with OpenCV2 to extract the digits from a picture of your digital wristwatch, and set the time according to that; OpenCV can instead of reading a picture file simply use a webcam, as well.

On a less automated notion, what's wrong with looking at your watch, noticing it's 13:25:03, typing timedatectl set-time "2022-05-24 13:26:00" and hitting enter exactly when that time actually happens? That's terrible in terms of accuracy, but low-effort.

$\endgroup$
11
  • $\begingroup$ Thank you for the detailed explanations. My goal was to have an alternative to NTP. I own a GPS dongle and it plays with NTP well. I'm curious about alternative methods other than using the time drift feature of JS8Call. The program adjtimex is exactly what I was looking for. Many watches have RF time sync and even if that time signal goes away, it's possible that the watch drift is still acceptable. $\endgroup$
    – wbg
    Commented May 24, 2022 at 15:26
  • 1
    $\begingroup$ GPS and NTP have um, nothing to do with each other per se? Maybe you mean you have an NTP server which can use a GPS dongle as time source? $\endgroup$ Commented May 24, 2022 at 15:33
  • $\begingroup$ I've been emailing with a Linux kernel programmer who has worked on gpsd. He says that a GPS dongle connected to a USB / UART is as bad a using a wrist watch. Makes sense since USB is just polled and doesn't hit any of the kernel space interrupts. Just for reference, the only good GPS is a true serial GPS. $\endgroup$
    – wbg
    Commented Jun 8, 2022 at 19:40
  • 1
    $\begingroup$ say hello to the kernel developer! the average serial interface on PC-style hardware has worse timing accuracy than the periodically, bus-controlled USB bus. (SDR engineer here) $\endgroup$ Commented Jun 8, 2022 at 19:42
  • $\begingroup$ also, as I, in breadth, explained above, even a good wristwatch is orders of magnitude worse than a GPS dongle, not just by some milliseconds that data might need through USB. You're confusing something if you say "it's just as bad as using a wrist watch": your gpsd expert assumed the watch was correct, which it very quickly isn't any more. $\endgroup$ Commented Jun 8, 2022 at 19:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .