SNTP Client

Fork of SNTPClient by Raphael Kwon

Revision:
1:a5a91530712d
Parent:
0:137fc24033c4
diff -r 137fc24033c4 -r a5a91530712d SNTPClient.h
--- a/SNTPClient.h	Fri Dec 19 05:46:22 2014 +0000
+++ b/SNTPClient.h	Thu Jun 15 20:17:11 2017 +0000
@@ -38,7 +38,7 @@
  * @brief Define it for Debug & Monitor DNS processing.
  * @note 
  */
-//#define _SNTP_DEBUG_
+#define _SNTP_DEBUG_
 
 #define MAX_SNTP_BUF_SIZE   sizeof(ntpformat)       ///< maximum size of DNS buffer. */
 #define ntp_port        123                     //ntp server port number
@@ -118,7 +118,9 @@
         *
         * @param url The SNTPClient host
         */
-        SNTPClient(char * url, uint8_t time_zone);
+        SNTPClient(NetworkStack *ns, const char* url, uint8_t time_zone);
+        
+        virtual ~SNTPClient() {close();}
 
         /**
         * Connect to the SNTPClient url
@@ -155,8 +157,10 @@
         uint16_t port;
         char host[32];
 
-        UDPSocket socket;
-        Endpoint sntp_server;
+        UDPSocket *m_udp;
+        NetworkStack *m_ns;
+
+        SocketAddress sntp_server;
 
         ntpformat NTPformat;
         datetime Nowdatetime;