07-12-2023 04:43 PM
Hi, I am trying to modify Altenbach's code https://forums.ni.com/ni/attachments/ni/170/515627/1/QueryNTPparse2.vi for acquiring time over NTP so that the round trip delay can be accounted for appropriately in my use case. My problem is identifying which item in the NTP packet is which. Not being very familiar with the terms I dont recognise those used by Altenbach in relation to those I have from other sources. Altenbach uses the following;
Reference timestamp
Originate timestamp
Receive timestamp
Transmit timestamp
these are used in wikipedia:
t0 is the client's timestamp of the request packet transmission,
t1 is the server's timestamp of the request packet reception,
t2 is the server's timestamp of the response packet transmission and
t3 is the client's timestamp of the response packet reception
I am trying to achieve; Time Correction = ((t2+t1)/2) - ((t3+t0)/2)
I made the alterations and ran the vi to see if that helped identify which packet was which but "originate timestamp" inexplicably came out differently than the others as shown in the attached png of the front panel. Perhaps there is more in Altenbach's code than I recognise? Any suggestions gratefully received.
Solved! Go to Solution.
07-12-2023 07:58 PM
I thought NTP already corrects for packet delay?
07-13-2023 08:13 AM - edited 07-13-2023 08:44 AM
Windows NTP etc have packet delay correction but I dont think this original code does. It came from here https://forums.ni.com/t5/LabVIEW/help-with-connecting-to-NIST-NTP-server-on-port-123/td-p/1030380/pa...
07-13-2023 10:52 AM
It's been a while since I've thought about NTP, but have you tried to go to https://ntp.org/ ?
Is setting up NTP on your computer an option?
07-13-2023 12:00 PM
Hi Bill,
Thanks, I am sure this process will work and I can trigger it with my main vi which is more useful. I have had problems with the time on my pc so like this I bypass all that.
07-24-2023 05:38 PM
Here's a slight update of the code which shows the times being output more clearly.
I am guessing that the originate TS is zero as its 01/01/1900, Reference time stamp doesnt seem to change and my computed result is way off of receive and transmit time stamps.
12-09-2023 03:35 PM
This is my solution with a decode of the terms used. I decided to record all four values t0 to t3 to work with later depending on the outcome. As long as the round trip delay (t3-t0)-(t2-t1) is small enough there shouldnt be a problem.