Git Product home page Git Product logo

Comments (5)

sgorpi avatar sgorpi commented on July 17, 2024

In addition: the user then has to write his own bool summertime(int year, byte month, byte day, byte hour, byte tzHours);
So maybe it's better to account for it in getTimeZone().

Cheers

from ntpclient.

gmag11 avatar gmag11 commented on July 17, 2024

I'll test it. I do not understand what you mean about summertime function. There is a function already defined inside class and used to find if a date is summer time or not. DST must be activated in begin() call. It is deactivated by default.

from ntpclient.

sgorpi avatar sgorpi commented on July 17, 2024

So, what I want to achieve is this: Send an email with the correct Date: header, which looks like "Date: Sep, 21 Sep 2016 21:40:21 +0100"
The +0100 is the indication of the timezone. Due to it currently being summertime (and me enabling the summertime correction), this should read +0200 in my region, but it doesn't. So, while the actual time is correctly adjusted for summertime, the getTimeZone is not.

In order for the user of the library to correct for this, he needs to know not only if DST correction is enabled, but also if it currently is the summertime period. You have a nice function for that in the library, but it is private, and thus not usable for an end user.
Therefore, I think it is best to return the summertime-adjusted timezone in getTimeZone() if DST is enabled. (For backwards compatibility, you could add a flag, e.g., getTimeZone(bool adjustedForDST=false))

Cheers

from ntpclient.

gmag11 avatar gmag11 commented on July 17, 2024

I think I've got what you mean.

I've added two public methods to develop branch.

boolean isSummerTime() returns true if current time is inside summertime period and false if it is winter time. If NTP is configured to not have DST enabled it always return false.

boolean isSummerTimePeriod(time_t moment) returns true if given time is inside summertime period.

I've checked that time zone is applied and can be changed with inmediate effect. Could you share your NTP initialization code?

from ntpclient.

gmag11 avatar gmag11 commented on July 17, 2024

As there is no answer after one month and I think it is solved I close the issue.

from ntpclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.