Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

NetworkTimeProtocol Returning odd offset, not fixing clock


ScottLB Jan 4, 2017 05:31 PM

Hi!

   Attempting to update CR1000 clock using IP server, code below. However, the TimeOffset variable is storing a very odd number, -2147483648, considering the CR1000 is only 20minutes (purposfully for testing) off. The number equates to 24.8 DAYS off, and the CR1000 clock does not change. I have changed the internal clock several times, but the number stored in TimeOffset does not change.

DataTable (NTPCheck,1,144)
  Sample(1,Logger_ID,IEEE4)
  Sample(1,Year,IEEE4)
  Sample(1,Julian_Day,IEEE4)
  Sample(1,Time_HHMM,IEEE4)
  Sample(1,Seconds,IEEE4)
  Sample(1,Decimal_Day,IEEE4)
  Sample (1,TimeOffset,Long)
EndTable

BeginProg

 SlowSequence
  Scan (10,Min,0,0)
      TimeOffset = NetworkTimeProtocol("129.6.15.30", -21600,1000)
      CallTable NTPCheck ' write to data table
      ClockReport (COMRS232,0,4095)
  NextScan

Results:

Date               Time            #        TimeOffset

2017-01-04    10:20:00      0       -2147483648
2017-01-04    11:00:00      1       -2147483648
2017-01-04    11:20:00      2       -2147483648
2017-01-04    11:40:00      3       -2147483648
2017-01-04    12:00:00      4       -2147483648
2017-01-04    11:20:00      5       -2147483648


GaryTRoberts Jan 4, 2017 05:35 PM

-2147483648 is a NAN for type long (most negative number for the data type long).  In the CRBasic help for NetworkTimeProtocol(), this number is returned when the logger is unable to reach the NTP server or there is an error in communication.


ScottLB Jan 4, 2017 05:41 PM

Well, that was an incredibly fast responce - thank you! I will try using a different IP, though I suspect that the company firewall may be halting us.

Log in or register to post/reply in the forum.