Home AMX User Forum AMXForums Archive Threads AMX Hardware
Options

Network Time Servers

Hey - does anybody know if I can set the Network Time server IP Address of the master from inside the program? I was thinking about something at startup.

I always forget to go into the web page and set that when I'm setting up a system

Comments

  • Options
    Joe HebertJoe Hebert Posts: 2,159
    How about:
    CLKMGR_ADD_USERDEFINED_TIMESERVER
    Adds a user-defined time server entry.

    CLKMGR_GET_ACTIVE_TIMESERVER
    Populates the TIMESERVER structure with the currently active time server's data.

    CLKMGR_SET_ACTIVE_TIMESERVER
    Sets the time server entry that has the matching IP-ADDRESS to the IP parameter as the active time server entry.
  • Options
    JohnMichnrJohnMichnr Posts: 279
    how 'bout 'em.

    Wonder when those came in. Looks like they should do the trick. The one thing I've never really understood is that they have the network time server setup to look for a NIST clock somewhere, is that the same as a network time protocol from a time server (NTP)?
  • Options
    Joe HebertJoe Hebert Posts: 2,159
    JohnMichnr wrote: »
    The one thing I've never really understood is that they have the network time server setup to look for a NIST clock somewhere, is that the same as a network time protocol from a time server (NTP)?
    I believe you get the time in NTP format from an NIST server.
  • Options
    JohnMichnrJohnMichnr Posts: 279
    Yeah - I did a little more digging and that is what it looked like to me as well. Looks like there is a NTP protocol and a Simple NTP protocol out there.
  • Options
    This is an interesting feature. I went ahead and tried to implement the calls into a program to have the control system sync the time from a NIST time sync server but I'm not having any luck. Does anyone happen to know what I am doing wrong?

    It doesn't seem to get the time from the time server.

    Here is the url for the time sync server I am trying to poll. For testing purposes I have the resync rate set to around 3 minutes according to the documentation I was following.

    http://tf.nist.gov/tf-cgi/servers.cgi

    Here is my code.

    Main body of code:
    PROGRAM_NAME='TimeSync Test'
    
    Define_Device
    
    dvTP = 10003:1:0
    
    Define_Variable
    
    Integer iTestText
    Integer iTimeServerReSyncRate
    Char TimeServerIP[15]
    Char TimeServerURL[30]
    Char TimeServerLocation[20]
    CLKMGR_TIMESERVER_STRUCT TimeServer
    
    Define_Module '12 Hour Clock' modClock(dvTP, iTestText)
    
    Define_Start
    
    iTestText = 1
    iTimeServerReSyncRate = 3
    TimeServerIP = '64.90.182.55'
    TimeServerURL = 'nist1-ny.ustiming.org'
    TimeServerLocation = 'Ney York City, NY'
    CLKMGR_ADD_USERDEFINED_TIMESERVER(TimeServerIP, TimeServerURL, TimeServerLocation)
    CLKMGR_SET_ACTIVE_TIMESERVER(TimeServerIP)
    CLKMGR_GET_ACTIVE_TIMESERVER(TimeServer)
    CLKMGR_SET_RESYNC_PERIOD (iTimeServerReSyncRate)
    

    12 hour clock module:
    Module_Name = '12 Hour Clock' (Dev dvTPNavigation, Integer iTimeChannel)
    
    Define_Variable
    
    Char iHour
    Char iMinute
    
    Define_Call 'Get The Time'
    {
        iHour = Type_Cast(Time_To_Hour(Time))
        iMinute = Type_Cast(Time_To_Minute(Time))
        If (iHour < 13)
        {
    	If (iMinute < 10)
    	{
    	    Send_Command dvTPNavigation, "'^TXT-', ITOA(iTimeChannel), ',0,', ITOA(iHour), ':0', ITOA(iMinute), ' AM'"
    	}
    	Else
    	{
    	    Send_Command dvTPNavigation, "'^TXT-', ITOA(iTimeChannel), ',0,', ITOA(iHour), ':', ITOA(iMinute), ' AM'"
    	}
        }
        Else
        {
    	iHour = iHour - 12
    	If (iMinute < 10)
    	{
    	    Send_Command dvTPNavigation, "'^TXT-', ITOA(iTimeChannel), ',0,', ITOA(iHour), ':0', ITOA(iMinute), ' PM'"
    	}
    	Else
    	{
    	    Send_Command dvTPNavigation, "'^TXT-', ITOA(iTimeChannel), ',0,', ITOA(iHour), ':', ITOA(iMinute), ' PM'"
    	}
        }
    }
    
    Define_Event
    
    Data_Event [dvTPNavigation]
    {
        Online:
        {
    	Call 'Get The Time'
        }
    }
    
    Define_Program
    
    Wait 600 'Get The Time'
    {
        Call 'Get The Time'
    }
    
  • Options
    OK - Update on this.

    I'm using the following code in Define_Start
    DEFINE_CONSTANT
    sNTPServer[]  =  {'137.22.128.2'}
    
    DEFINE_START
    wait 100
    {
    	CLKMGR_ADD_USERDEFINED_TIMESERVER(sNTPServer,sNTPServer,'Network')
    	CLKMGR_SET_ACTIVE_TIMESERVER(sNTPServer)
    	clkmgr_set_clk_source(clkmgr_mode_network)
    	
    }
    

    But it doesn't seem to be working - The web pages on the masters show that they have loaded the time server in and selected it - but I dont' seem to be updating the clock in the masters. Of course now with DST ending all the systems are off an hour.

    Any ideas from anybody?
  • Options
    champchamp Posts: 261
    Your location is misspelt.
    Try entering the details manually into the master and see if it works.
    Try using the same details on a PC to make sure the time server will respond to that.
  • Options
    Yeah - I figured it out - put the wrong IP Address in for the time server. Duh

    Boy that really confounded the master. you couldn't even go in and manually reset the time.
Sign In or Register to comment.