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_ntp
import socketpool
import time
import wifi

# Get wifi details and more from a secrets.py file
try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise

wifi.radio.connect(secrets["ssid"], secrets["password"])

pool = socketpool.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.0.8.tar.gz (28.1 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.0.8-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file adafruit-circuitpython-ntp-3.0.8.tar.gz.

File metadata

File hashes

Hashes for adafruit-circuitpython-ntp-3.0.8.tar.gz
Algorithm Hash digest
SHA256 969e2ea9c600a4a00336fad36650a3a504b6873623a2f981a7b1fa224c0a7fca
MD5 baae92c42e99c867edf69f1d934f41f2
BLAKE2b-256 b5aba556dc193b5f350bb94d7a1c3f30e26b241805f469ccb36430f5d2a562ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cf2f3e5aca0134486f9c6c98faa4df893efaef5917f9ce189efb98ef46547758
MD5 166bc9d160581f48449bd3c8da5d2c2f
BLAKE2b-256 c98f43dbd27a24266a0c9b875cd3ba18fdf227ca7b04109da057e89531daeb79

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