Споделяне чрез


Networking_TimeSync_EnableCustomNTP function

Header: #include <applibs/networking.h>

Instructs the device to use the NTP server addresses provided by the user. Up to two host names or IP addresses may be specified and up to three will be attempted if the default server is enabled.

int Networking_TimeSync_EnableCustomNtp(const char *primaryNtpServer, const char *secondaryNtpServer, Networking_NtpOption option);

Parameters

  • primaryNtpServer The primary NTP server address to use.
  • secondaryNtpServer The secondary NTP server address to use. This can be set to NULL.
  • option Enables or disables the default NTP server.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EFAULT: the primaryNtpServer is NULL.

  • EACCES: the calling application doesn't have the TimeSyncConfig capability.

  • ERANGE: the primaryNtpServer or secondaryNtpServer length is greater than the maximum FQDN length or is not null-terminated.

Any other errno may also be specified; such errors aren't deterministic, and there is no guarantee that the same behavior will be retained through system updates.

Return value

Returns 0 for success, or -1 for failure, in which case errno will be set to the error value.

Concepts and samples