Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Firebase-Example TCP-NTP-Server TCP-NTP-Server-OS5depreciated
Revision 1:a97d143dd94e, committed 2020-06-01
- 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 |
--- 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);
}
--- 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)