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.1.tar.gz (26.9 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.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.1.1.tar.gz
Algorithm Hash digest
SHA256 71d9251ec41b59818594bbdb5ef0094e1516aa854f4253baed7cecb64a6344ec
MD5 1b85b621ab8d65b90254ca5a739b8afa
BLAKE2b-256 f6a01369d346b8ee326172b420283c39cdf51245e70f6a7a6f62e0ea939e1918

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17e717cbeee1a1ab47bce70322ca8dadc21ffae91dd1364755630ef8207e2ac3
MD5 400754c20f505b9a1afd3a699adfe49f
BLAKE2b-256 b9cf2264aa7bb5a93ff6f277257c3f8e848e4746bf3aa70673194810e0c662f0

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