Skip to content

Add optional timezone offset for NTP.set_time() #10

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

Merged
merged 2 commits into from
May 12, 2020

Conversation

theelectricmayhem
Copy link
Contributor

Updated NTP.set_time() to accept an optional tz_offset which adjusts the recorded time by that number of hours.

@brentru brentru requested a review from a team May 12, 2020 14:06
Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theelectricmayhem Thanks for the PR, looks great!

I can't merge this in because it is failing on Black's code formatting check (https://github.com/adafruit/Adafruit_CircuitPython_NTP/pull/10/checks?check_run_id=661578319#step:11:8).

Please follow this guide to install and run Black on your code: https://learn.adafruit.com/improve-your-code-with-pylint/black

@theelectricmayhem
Copy link
Contributor Author

Thanks! Hopefully Black cleaned up that formatting issue. Is there a particular target version of python used for Adafruit libraries I should be using with Black?

@brentru
Copy link
Member

brentru commented May 12, 2020

Seems like 3.5? Via the Action:

Run black --check --target-version=py35 .

@brentru brentru merged commit c8ec219 into adafruit:master May 12, 2020
@theelectricmayhem
Copy link
Contributor Author

Seems like 3.5? Via the Action:

Run black --check --target-version=py35 .

Sweet. Thanks

Copy link
Contributor

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all time zone offsets are whole hours. Please consider following the example of Python, which uses seconds for timezone offsets (time.timezone). It would also be good if the docstring states what the units of tz_offset are, and whether to expect the number to be positive or negative depending where you are, e.g., if you follow how Python defines timezone:

The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK).

@theelectricmayhem
Copy link
Contributor Author

That's absolutely the right way to do it. Thanks! New PR

@jepler
Copy link
Contributor

jepler commented May 13, 2020

Aha I didn't see that the PR had already been merged. Looking forward to the next one and thanks @theelectricmayhem !

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request May 13, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_NTP to 2.0.0 from 1.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_NTP#10 from theelectricmayhem/patch-1
  > build.yml: add black formatting check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants