Skip to content

Update WiFiRTC.md regarding the timezone #1632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arlbarto
Copy link

What This PR Changes

Correction on the code to handle the GMT info.

The orginial code adds the GMT variable at the moment of printing the hour:
print2digits(rtc.getHours() + GMT);

But the concept is wrong because only operates hours but doesn't contemplate if that operation affects the change of date (adding or subtracting). The correct way is to add/substract 3600 seconds per hour of GMT to the value got from epoch:
rtc.setEpoch(epoch+ GMT*3600); //Add the time zone to the epoch

Contribution Guidelines

Correction to add the GMT info
orginial code:
 print2digits(rtc.getHours() + GMT);

That line is wrong because only adds hours but doesn't contemplate if that sum affects the change of date (adding or subtracting)
The correct way is to add/substract 3600 seconds per hour of GMT to the value got from epoch
@CLAassistant
Copy link

CLAassistant commented Dec 26, 2023

CLA assistant check
All committers have signed the CLA.

@jhansson-ard jhansson-ard added fix/update A small fix or update community Bugs and fixes suggested by the community labels Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Bugs and fixes suggested by the community fix/update A small fix or update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants