Skip to main content

Network Time Protocol (NTP) helper for Python

Project description

Introduction

Documentation Status Discord Build Status Code Style: Black

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)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adafruit_circuitpython_ntp-3.1.0.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file adafruit_circuitpython_ntp-3.1.0.tar.gz.

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.1.0.tar.gz
Algorithm Hash digest
SHA256 f05eecc8d13fdb09f3235b110c671874f801eb0a01525dfe8daa15b9ee057185
MD5 26c2dfcb3d39d1ebcebe14579bac3ab3
BLAKE2b-256 b295e482cc493ce3e147c4848820f48535c59ac9bfa0baea01820c8f35f9a831

See more details on using hashes here.

File details

Details for the file adafruit_circuitpython_ntp-3.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f11894d0b34ebda8810fba0e380025e9d782820c222c92bf76315180acc0c6b5
MD5 aa3d56c7df14005c5d7e6292f158e909
BLAKE2b-256 e4a38e50d65d2b4c66e7d8bb5aaa264312053e7f73b884acd05596910be7117a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page