05-09-2011 09:14 AM
Hello,
I have a question regarding the file "ts_sntp_log.txt" that is written on the internal disc of the cRIO when the device is synchronized to an NTP server. I have performed a measurement where the network latency is relevant to know. I am now trying to analyze the log file in Matlab.
This is the only info I can find regarding the time format on the file:
http://digital.ni.com/public.nsf/allkb/F2B057C72B537EA2862572D100646D43
and
http://www.faqs.org/rfcs/rfc2030.html
The timestamps in my Tdms file are correct, so I suppose that the cRIO managed to synchronize to the NTP server during the measurement.
This is a few lines from my log file
**************************************************************************
2eb2c57243acbbd3: 98999630.450878, 000008199a840185, 2eb2c5724049c687, 2eb2c572404be4a6, 000008199a876693
2eb2c5803c13647d: 98999633.822424, 0000081afc93ea5f, 2eb2c58038b10bbc, 2eb2c58038b32a62, 0000081afc976f60
2eb2c58e347e54d9: 98999644.899869, 0000081c5ea3cdb7, 2eb2c58e3120db8b, 2eb2c58e312365e0, 0000081c5ea85bd3
**************************************************************************
As I have interpreted the reference documents, the first number is the time on the cRIO formatted so that the first 8 digits are the number of whole seconds starting from 1900-01-01. My measurement was carried out in 2010 so this number should be
(2011-1900)*365*24*3600 = 3.500496e+009
I use the following Matlab lines to convert the hex-number into whole seconds
ts = '2eb2c57243acbbd3';
sec_from_1900 = hex2dec(['00000000',ts(1:8)])
which turns out to be 783468043, i.e., approx 25 years.
Am I doing something wrong, or is the log file corrupt? If it is corrupt, how can the timing info in my Tdms file still be correct?
I would be very greatful for some help on this.
Regards // Johan
05-19-2011 06:05 AM
Hello again everyone,
Is there really nobody out there who has got some information on this? I still believe that the hexadecimal numbers in the file ts_sntp_log.txt are correct since the timestamps written i my TDMS files are correct. I cannot understand the format in the log file though, and the support people at NI sweden has not been able to help me either. I now get the year 1999.
Does anyone know where to find the exact algorithm for recalculating timestamps (in seconds) in LabView into yy-mm-dd HH:MM:SS.FFFFFF - format?
I attach my files and would be very helpful if somebody could have a look at them. Unfortunately the upload function rejected Matlab files so I had to change the file extension into .txt. Just change the following:
replaceinfile.txt --> replaceinfile.m
import_ts_sntp_log.txt --> import_ts_sntp_log.m
and it should work fine.
Regards
Johan
11-10-2011 11:14 AM - edited 11-10-2011 11:14 AM
Hi Johan,
I'm working on the same task of deciphering the log file.
I have found that the first column (currentLocalTimeNS) is actually nanoseconds since 0:00:00 (midnight) Jan 1, 1904. At least when I convert the value to seconds and then use Seconds To Date/Time VI, the output timestamps sync right up with when I had logging enabled. However, I'm struggling understanding how to make sense of the "raw" output, specifically T1 and T4. When I try to calculate the round trip delay, (after converting t2 and t3 which are in the same format as currentLocalTimeNS) I get results that are nonsense.
If anyone has specific details about the format of this log, please post!
Cheers,
Ryan