Comments (5)
NTP itself can't handle timezones nor daylight saving times. That's normally the job of the operating system.
What you can do, however, since the daylight savings occur in specific period of time (october 15 to february 17 here) you can just validate the output the DD/MM and adjust the offset accordingly.
Or you can just use the Timezone library.
from ntpclient.
I've tried using the TimeOffset parameter in both Constructor and setTimeOffset(). Both does NOT work :(
It still outputs the same time (GMT-2, I think)
from ntpclient.
from ntpclient.
This may help. This function looks for the last sunday of a month and returns the utc. You may refine it for the correct hour that the change occurs.
E.g. here the change is on the last sunday of march and the last sunday of october. Call the function twice for march and october and if the real time falls between the two, it is summer.
BTW: dow() returns day of week as an integer between 0 and 6 inclusive, for the array 'sun','mon', 'tue' etc... weekday() would probably also work, but starts from 1.
Disclaimer: I took this from my code, but cobbled a bit to make it understandable, YMMV.
t=now();
time_t llz=laatstezondag(3,31,year());
time_t hlz=laatstezondag(10,31,year());
if ((t>llz) && (t<hlz)) zomer=1; else zomer=0;
...
time_t laatstezondag(int maand,int dag,int jaar)
{ time_t nu,lz;
char w_dag[4]="xxx";
nu=now();
while ((strcmp(w_dag,"sun")) && (dag>24))
{
setTime(2, 0, 0, dag--, maand, jaar);
strcpy(w_dag,weekdag[dow(now())]);
lz=now();
}
setTime(nu);
return lz;
}
from ntpclient.
Windows 10 cannot do it either. So, fix it yourself and good luck.
from ntpclient.
Related Issues (20)
- Checking received data for correctness and verbose debugging
- on esp32 with fixed ip, it doesn't work HOT 1
- Time offsets >±32,535 seconds still busted in version 3.2.0 HOT 1
- getting 16 hours more that the current
- NTPClient::update() now always returns `false` HOT 10
- isTimeSet() does not reset when update fail HOT 1
- Memory buffer could be stack allocated, saving global memory. HOT 2
- what will the timeClient.update() function do when there's no internet HOT 1
- getFormattedDate() in 3.1.0 no longer in latest3.2.1 HOT 1
- Poll interval is much to often
- NTP Time Incorrect HOT 1
- Add set function to define the response timeout
- Add the functionallity to get the date HOT 1
- Add handling for NTP server returning 0 HOT 4
- Missing method HOT 1
- Automatic summer/winter time change HOT 1
- So Funny ehehehe (LOL) Please read this.
- Change signature of function to set the offset to long HOT 1
- How to set automatic summer/winter time? HOT 1
- ntpcliente getformatedDate HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ntpclient.