OS5.15 complaint NTP library

Dependents:   Firebase-Example TCP-NTP-Server TCP-NTP-Server-OS5depreciated

Files at this revision

API Documentation at this revision

Comitter:
star297
Date:
Mon Jun 01 16:16:42 2020 +0000
Parent:
0:3854dc7bd4de
Commit message:
added DST

Changed in this revision

NTPclient.cpp Show annotated file Show diff for this revision Revisions of this file
NTPclient.h Show annotated file Show diff for this revision Revisions of this file
diff -r 3854dc7bd4de -r a97d143dd94e NTPclient.cpp
--- a/NTPclient.cpp	Sun Mar 08 14:32:36 2020 +0000
+++ b/NTPclient.cpp	Mon Jun 01 16:16:42 2020 +0000
@@ -114,12 +114,12 @@
         
         uint32_t previousSunday = day - dow;
         if (month > 2 && month < 9){DST=3600;}
-        // DST starts 2nd Sunday of March;  2am            
-        if (month == 2 && previousSunday >= 25 && hour >= 2){DST=3600;}
-        // DST ends 1st Sunday of November; 2am
+        // DST starts last Sunday of March; 2am (1am UTC)          
+        if (month == 3 && previousSunday >= 25 && hour >= 2){DST=3600;}
+        // DST ends last Sunday of october; 2am (1am UTC)
         if (month == 9 && previousSunday < 25 && hour >= 2){DST=0;}
     }            
-    if(setRTC){set_time(CETtime+DST+1);} // add extra second here for processing         
+    if(setRTC){set_time(CETtime+DST);}         
     m_sock.close();
     return (CETtime+DST+1);
 }
diff -r 3854dc7bd4de -r a97d143dd94e NTPclient.h
--- a/NTPclient.h	Sun Mar 08 14:32:36 2020 +0000
+++ b/NTPclient.h	Mon Jun 01 16:16:42 2020 +0000
@@ -16,7 +16,7 @@
 {
 public:  
     NTPclient(NetworkInterface & _m_intf);
-    // Returns current time in seconds (blocking)
+    // Get current time in seconds (blocking)
     // Update the time using the server host
     // Blocks until completion
     // NTPpool, NTP server IPv4 address or hostname (will be resolved via DNS)