Appendix C: Clock Manager NetLinx Programming API
113
NetLinx Integrated Controllers (Firmware v4)- WebConsole & Programming Guide
Appendix C: Clock Manager NetLinx Programming
API
Types/Constants
The NetLinx.axi file that ships with NetLinx Studio includes the following types/constants:
(*-----------------------------------------------------------------------------*)
(* Added v1.28, Clock Manager Time Offset Structure *)
(*-----------------------------------------------------------------------------*)
STRUCTURE CLKMGR_TIMEOFFSET_STRUCT
{
INTEGER HOURS;
INTEGER MINUTES;
INTEGER SECONDS;
}
(*-----------------------------------------------------------------------------*)
(* Added v1.28, Clock Manager Time Server Entry Structure *)
(*-----------------------------------------------------------------------------*)
STRUCTURE CLKMGR_TIMESERVER_STRUCT
{
CHAR IS_SELECTED; (* TRUE/FALSE *)
CHAR IS_USER_DEFINED; (* TRUE/FALSE *)
CHAR IP_ADDRESS_STRING[48]; (* Allow enough room for IPv6 in the future *)
CHAR URL_STRING[32]; (* Example: time.organization.net *)
CHAR LOCATION_STRING[32]; (* Example: Boulder, Colorado, US *)
}
(* Added v1.28, Clock Manager *)
INTEGER CLKMGR_MODE_NETWORK = $01; (* Used to enable Clock Manager Functionality *)
INTEGER CLKMGR_MODE_STANDALONE = $02; (* Use a free-running clock - legacy behavior.*)
Library Calls
The NetLinx.axi file that ships with NetLinx Studio includes the following Clock Manager-specific library calls:
NetLinx.axi - Library Calls
CLKMGR_IS_NETWORK_SOURCED()
Returns FALSE/0 or TRUE/1 (default = FALSE/0)
CLKMGR_SET_CLK_SOURCE
(CONSTANT INTEGER MODE)
Can be set to CLKMGR_MODE_NETWORK or CLK-MGR_MODE_STANDALONE.
CLKMGR_IS_DAYLIGHTSAVINGS_ON()
Returns FALSE/0 or TRUE/1 (default = FALSE/0).
CLKMGR_SET_DAYLIGHTSAVINGS_MODE
(CONSTANT INTEGER ONOFF)
Can be set to ON/TRUE or OFF/FALSE.
CLKMGR_GET_TIMEZONE()
Returns Timezone as a string in the format: UTC[+|-]HH:MM
CLKMGR_SET_TIMEZONE
(CONSTANT CHAR TIMEZONE[])
Input string must have the correct format: UTC[+|-]HH:MM
CLKMGR_GET_RESYNC_PERIOD()
Returns the Clock Manager's re-sync period in minutes (default = 60). This
setting has no effect if the Clock Manager mode is set to STANDALONE.
CLKMGR_SET_RESYNC_PERIOD
(CONSTANT INTEGER PERIOD)
Sets the re-sync period to the specified minute value. The upper bound is 480
minutes (i.e., 8 hours).
CLKMGR_GET_DAYLIGHTSAVINGS_OFFSET
(CLKMGR_TIMEOFFSET_STRUCT T)
Populates the TIMEOFFSET structure with the current Daylight Savings Offset
configured. The function returns a negative SLONG value if it encounters an
error.
CLKMGR_SET_DAYLIGHTSAVINGS_OFFSET
(CONSTANT CLKMGR_TIMEOFFSET_STRUCT T)
Sets the Daylight Savings Offset to the specified value.
CLKMGR_GET_ACTIVE_TIMESERVER
(CLKMGR_TIMESERVER_STRUCT T)
Populates the TIMESERVER structure with the currently active time server's
data. The function returns a negative SLONG value if it encounters an error.
CLKMGR_SET_ACTIVE_TIMESERVER
(CONSTANT CHAR IP[])
Sets the time server entry that has the matching IP-ADDRESS to the IP
parameter as the active time server entry.