Funzione Networking_SetNtpStateNetworking_SetNtpState Function
Intestazione: #include <applibs/networking.h>Header: #include <applibs/networking.h>
Importante
questa funzione è obsoleta.This function is obsolete. Usare invece Networking_TimeSync_SetEnabled.Use Networking_TimeSync_SetEnabled instead.
Abilita o disabilita il servizio di sincronizzazione dell'ora NTP.Enables or disables the NTP time-sync service. Le modifiche diventano effettive immediatamente senza un riavvio del dispositivo e sono permanenti.The changes take effect immediately without a device reboot and are persisted. Il servizio NTP viene quindi configurato come richiesto in fase di avvio.The NTP service is then configured as requested at boot time. Questa funzione consente alle applicazioni di ignorare il comportamento predefinito, ovvero l'abilitazione del servizio NTP in fase di avvio.This function allows applications to override the default behavior, which is to enable the NTP service at boot time.
Nota
Il servizio NTP è abilitato per impostazione predefinita.The NTP service is enabled by default. Se si imposta l'ora di sistema mentre è abilitato il servizio NTP, sovrascriverà l'ora UTC quando il dispositivo ha connettività Internet.If you set the system time while the NTP service is enabled, it will overwrite the UTC time when the device has internet connectivity. È possibile disabilitare il servizio NTP anche se ciò può causare errori per gli aggiornamenti cloud nel dispositivo se la differenza tra l'ora di sistema e l'ora del server NTP è troppo grande.You can disable the NTP service; however, this can cause cloud updates on the device to fail if the difference between the system time and the NTP server time is too great.
int Networking_SetNtpState(bool isEnabled);
ParametriParameters
isEnabled
true per abilitare il servizio NTP, false per disabilitarlo.isEnabled
true to enable the NTP service, false to disable it.
ErrorsErrors
Restituisce-1 se viene rilevato un errore e imposta sul errno
valore di errore.Returns -1 if an error is encountered and sets errno
to the error value.
EACCES: il chiamante non ha la funzionalità NetworkConfig.EACCES: the caller doesn't have the NetworkConfig capability.
EAGAIN: lo stack di rete non è ancora pronto.EAGAIN: the networking stack isn't ready yet.
errno
È possibile specificare anche qualsiasi altro tipo di errore. tali errori non sono deterministici e lo stesso comportamento potrebbe non essere mantenuto tramite gli aggiornamenti del sistema.Any other errno
may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.
Valore restituitoReturn value
Restituisce 0 per l'esito positivo o-1 per l'esito negativo, nel qual caso errno
viene impostato sul valore di errore.Returns 0 for success, or -1 for failure, in which case errno
is set to the error value.