diff --git a/third_party/sntp/sntp.cpp b/third_party/sntp/sntp.cpp index e92d977..d956d72 100644 --- a/third_party/sntp/sntp.cpp +++ b/third_party/sntp/sntp.cpp @@ -15,13 +15,15 @@ nsapi_value_or_error_t dns_result; // Result from the DNS callback SocketAddress dns_addr; // DNS address from the DNS callback -void gethostbyname_callback(nsapi_value_or_error_t result, SocketAddress *address) { +void gethostbyname_callback( + nsapi_value_or_error_t result, SocketAddress *address) { dns_result = result; dns_addr = *address; dns_arrived.set(1); } -nsapi_error_t gethostbyname_timeout(NetworkInterface &net, const char* server, SocketAddress &addr, uint32_t timeout_ms) { +nsapi_error_t gethostbyname_timeout(NetworkInterface &net, const char *server, + SocketAddress &addr, uint32_t timeout_ms) { // Clear flags before call in case we had an unexpected callback dns_arrived.clear(); @@ -29,12 +31,12 @@ nsapi_value_or_error_t dns_id; dns_id = net.gethostbyname_async(server, gethostbyname_callback); - if(dns_id < 0) { + if (dns_id < 0) { // dns_id is an error, creating the async transaction failed return dns_id; } - if(dns_arrived.wait_any(1, timeout_ms) != 1) { + if (dns_arrived.wait_any(1, timeout_ms) != 1) { // We timed out, cancel the transaction net.gethostbyname_async_cancel(dns_id); return NSAPI_ERROR_TIMEOUT; diff --git a/third_party/sntp/sntp.h b/third_party/sntp/sntp.h index 8eb3f7f..db63acf 100644 --- a/third_party/sntp/sntp.h +++ b/third_party/sntp/sntp.h @@ -7,8 +7,8 @@ #ifndef SNTP_H #define SNTP_H -#include #include "NetworkInterface.h" +#include enum SNTPError { SNTPSuccess = 0,