-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
There was a problem hiding this 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
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? |
Seems like 3.5? Via the Action:
|
Sweet. Thanks |
There was a problem hiding this 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).
That's absolutely the right way to do it. Thanks! New PR |
Aha I didn't see that the PR had already been merged. Looking forward to the next one and thanks @theelectricmayhem ! |
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
Updated
NTP.set_time()
to accept an optionaltz_offset
which adjusts the recorded time by that number of hours.