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, 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


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.3.0.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adafruit_circuitpython_ntp-3.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.3.0.tar.gz
Algorithm Hash digest
SHA256 4eb82f534a9c8f2df20f7c9f93b7476675e62aa24b7e4cdd020473b151506e84
MD5 8f2b8fb4c4eb2d8203548a70efe2dd5d
BLAKE2b-256 6db97152f7d4dcf225a9b0921d00b6d7c1a6fc4ab273acb9fdfa9070fa9cda4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e504327515898877bdbd403d41e9ec5152703ca2c9cc228d5206fa6e1f1d723f
MD5 e5089d6131b4fc525141d66a3f3336f8
BLAKE2b-256 91d53a31e32c8986c6ff97e2aa2451af0a8ba7002ee5fd0a466a4fc8bac2cf4e

See more details on using hashes here.

Supported by

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