Skip to main content

Python NTP library

Project description

Description

This module offers a simple interface to query NTP servers from Python.

It also provides utility functions to translate NTP fields values to text (mode, leap indicator…). Since it’s pure Python, and only depends on core modules, it should work on any platform with a Python implementation.

Example

>>> import ntplib
>>> from time import ctime
>>> c = ntplib.NTPClient()
>>> response = c.request('europe.pool.ntp.org', version=3)
>>> response.offset
-0.143156766891
>>> response.version
3
>>> ctime(response.tx_time)
'Sun May 17 09:32:48 2009'
>>> ntplib.leap_to_text(response.leap)
'no warning'
>>> response.root_delay
0.0046844482421875
>>> ntplib.ref_id_to_text(response.ref_id)
193.190.230.66

Installation

As root:

# python setup.py install

or just copy ntplib.py inside a directory in your sys.path, e.g. /usr/lib/python2.5/.

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

ntplib-0.4.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

ntplib-0.4.0-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ntplib-0.4.0.tar.gz.

File metadata

  • Download URL: ntplib-0.4.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for ntplib-0.4.0.tar.gz
Algorithm Hash digest
SHA256 899d8fb5f8c2555213aea95efca02934c7343df6ace9d7628a5176b176906267
MD5 4c2118f6ef0d8c2c8a4f53d6318b2245
BLAKE2b-256 b4146b018fb602602d9f6cc7485cbad7c1be3a85d25cea18c233854f05284aed

See more details on using hashes here.

File details

Details for the file ntplib-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ntplib-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for ntplib-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8d27375329ed7ff38755f7b6d4658b28edc147cadf40338a63a0da8133469d60
MD5 6027ba9a42b13a7f8579574918e25eea
BLAKE2b-256 588c41da70f6feaca807357206a376b6de2001b439c7f78f53473a914a6dbd1e

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