On Sunday, 30 June 2019 12:09:53 UTC+10, stu...@longlandclan.id.au  wrote:
> Hi all,
> 
> This will seem like a silly request, but how do you set the sntp client 
> (distributed with the 'ntp' package in Debian) port number?

Okay, so after no on-list replies, but one off-list reply offering (likely for 
a significant fee) to provide a patched version that had the required feature.  
This implies that someone was naïve enough to assume the destination port 
number was never going to change.

So, a work-around which I'll post here for the next person who needs this.

There exists a very simple SNTP client at 
https://github.com/lettier/ntpclient/blob/master/source/python/ntpclient.py

It is crude, but my workplace actually uses the C version of this with good 
results on 6LoWPAN based networks.

The code in the Python version normally just returns the current time.  Add 
`import os` to the start of the file, then replace the final `print` line with 
the following:

```
# Set the time
os.system('date %s' % ts_val.strftime('%m%d%H%M%Y.%S'))
```

Now when called as `root` from a `cron` job, it will update the system time.  
There's a few additional tweaks needed to make it work on Python 3, but the 
gist is there.

_______________________________________________
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions

Reply via email to