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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for adafruit-circuitpython-ntp-3.0.4.tar.gz
Algorithm Hash digest
SHA256 89e5f739a99ca0f3371b8721800ce5f6741231d75bb03c8208b30b3af5ef4a75
MD5 d8f3afb9d1c16fef03880cd6a4a3953b
BLAKE2b-256 363e768131423eee2cf04220e8164a94ba43e0d72a361153f8436b573e87957b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_ntp-3.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6814319d711d6d189107a63d7a25d1c3f30c7537f4387865dfa4d1ccc74138cd
MD5 ecb41b65be8b71823be686adde1e9b14
BLAKE2b-256 c5169d8b9be8e9176a81869920b7c5cc941838a9d40f5c6082f754648d459e5a

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