Skip to content
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

refactor to extract ntp update logic #39

Merged
merged 2 commits into from
Jul 23, 2024
Merged

refactor to extract ntp update logic #39

merged 2 commits into from
Jul 23, 2024

Conversation

mMerlin
Copy link
Contributor

@mMerlin mMerlin commented Jul 20, 2024

Extract the ntp lookup logic to a separate method.
change to use integer nanoseconds for the monotonic start reference.

  • this provides sub-second accuracy. For the datetime property, that adjusts exactly when the seconds value rolls over to the next second.

Add utc_ns property to return the raw nanoseconds since the unix epoch. For cases were more precision than ±1 second is wanted.

use nanoseconds start reference
@mMerlin
Copy link
Contributor Author

mMerlin commented Jul 20, 2024

It seems that black does not like where I did or did not wrap lines. Should I edit to match and re-push?

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Refactor looks good.

Please install pre-commit. It'll reformat for you: https://learn.adafruit.com/improve-your-code-with-pylint/check-your-code-with-pre-commit

make precommit happy with line wrapping
@mMerlin
Copy link
Contributor Author

mMerlin commented Jul 23, 2024

setup local precommit to adjust formatting.
updated 2 of the examples to use settings.toml instead of secrets.py.

@mMerlin mMerlin requested a review from tannewt July 23, 2024 05:44
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you!

@tannewt tannewt merged commit 2d9562c into adafruit:main Jul 23, 2024
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 30, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_BME280 to 2.6.25 from 2.6.24:
  > Merge pull request adafruit/Adafruit_CircuitPython_BME280#69 from rwmanos/patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_BME680 to 3.7.8 from 3.7.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_BME680#73 from FoamyGuy/precommit_copyright
  > Merge pull request adafruit/Adafruit_CircuitPython_BME680#70 from justmobilize/ruff-updates

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1106 to 1.4.0 from 1.3.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SH1106#19 from EAGrahamJr/issue-16

Updating https://github.com/adafruit/Adafruit_CircuitPython_EMC2101 to 1.2.6 from 1.2.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_EMC2101#34 from rpavlik/fix-name

Updating https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731 to 3.4.1 from 3.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3731#55 from grandinquisitor/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 6.3.4 from 6.3.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#134 from justmobilize/ruff-updates

Updating https://github.com/adafruit/Adafruit_CircuitPython_NTP to 3.3.0 from 3.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_NTP#39 from mMerlin/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_PortalBase to 2.1.1 from 2.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#102 from justmobilize/ruff-updates

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 4.1.6 from 4.1.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#202 from FoamyGuy/precommit_copyright
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#173 from justmobilize/ruff-updates

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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.

2 participants