SNTPGetUTCTime (FB)¶
FUNCTION_BLOCK SNTPGetUTCTime
Sends a SNTP request to a NTP/SNTP server and reads the current server time.
- InOut:
Scope
Name
Type
Initial
Comment
Input
xExecuteBOOLA rising edge starts the SNTP request
sSNTPServerSTRING(255)IP address of the NTP/SNTP server
sOwnIPSTRING(255)‚0.0.0.0‘
Optional: IP address of the PLC, Default: 0.0.0.0
uiSNTPPortUINTPort of the NTP/SNTP server
uiOwnPortUINTOwn port
udiTimeoutUDINT1000
Timeout in ms (default 1000)
eNTPVersionNTP_VERSION.V3
Version of the NTP protokol (default V3)
Output
xDoneBOOLTrue if the call has been finished
xBusyBOOLTrue while the request is running
xErrorBOOLTrue if an error occured.
eErrorError code
uliTimestampULINTCurrent UTC time in milliseconds since 1.1.1970 of the NTP/SNTP server with roundtrip correction. You can use the function SysTimeRtc.SysTimeRtcConvertHighResToLocal to convert the UTC time to SysTimeRtc.SYSTIMEDATE.
uliReceiveClientTSULINTCurrent UTC time in milliseconds since 1.1.1970 when the timestamp has been received by the client (current time of the runtime). You can use the function SysTimeRtc.SysTimeRtcConvertHighResToLocal to convert the UTC time to SysTimeRtc.SYSTIMEDATE.