Network Time Protocol (NTP) helper for Python
Project description
Introduction
Network Time Protocol (NTP) helper for CircuitPython.
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-ntp
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-ntp
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-ntp
Usage Example
import adafruit_connection_manager
import adafruit_ntp
import os
import time
import wifi
wifi_ssid = os.getenv("CIRCUITPY_WIFI_SSID")
wifi_password = os.getenv("CIRCUITPY_WIFI_PASSWORD")
wifi.radio.connect(wifi_ssid, wifi_password)
pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio)
ntp = adafruit_ntp.NTP(pool, tz_offset=0, cache_seconds=3600)
while True:
print(ntp.datetime)
time.sleep(1)
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for adafruit_circuitpython_ntp-3.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cf2911016c125a0cb6a5bfb2c414d75303559f3e2d4a42e34e0f3d95ebb0920 |
|
MD5 | 757578d4cdbe41b21ed9d9557339f15e |
|
BLAKE2b-256 | 8681d6fa2ef080728ad8d42f81ebdd2afe39a2d80c9f51baa7b85c1e4f5144e6 |
Hashes for adafruit_circuitpython_ntp-3.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 201f4406861fb744ebf2ef4d5f13e3c00acdf87dc2b53a0f336325e6e7779ac0 |
|
MD5 | ce24d68eefab068502cddb7216491ca0 |
|
BLAKE2b-256 | fa627c16c137c7103959eda87165434f5b736f57d9ec95c34e966cfa1948eec3 |