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

Uploaded Source

Built Distributions

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

ntplib-0.3.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

ntplib-0.3.4-py2-none-any.whl (5.9 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: ntplib-0.3.4.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.3

File hashes

Hashes for ntplib-0.3.4.tar.gz
Algorithm Hash digest
SHA256 9fc99f71b14641b31698e4ced3d5f974eec225bfbae089ebe44b5808ba890f71
MD5 c3474b95033dc79ffcd33bcf840aa8b0
BLAKE2b-256 a2dd2202de134bfb7131d6d227026690e0901d58285e8333707f2f91392d0500

See more details on using hashes here.

File details

Details for the file ntplib-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: ntplib-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for ntplib-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 63b99b0ac670f8283b8d8e5cf75aab1d0d9f62e17d38d1fedc4291e1ce8bd052
MD5 d93ba8d9ea2dfc57e66827747b916884
BLAKE2b-256 1980d09d5ee0eb47351a7ea057538eae869dafc2c342a4ed37ac5dea2b066c21

See more details on using hashes here.

File details

Details for the file ntplib-0.3.4-py2-none-any.whl.

File metadata

  • Download URL: ntplib-0.3.4-py2-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for ntplib-0.3.4-py2-none-any.whl
Algorithm Hash digest
SHA256 1c0ca99485a1abf64db7a5b7502874f255666d219aacfb7ad701ea83e78e2dcf
MD5 dee102b53d4002617459097646f8d1be
BLAKE2b-256 97e54cc40ad5611035bf356accf82d3f5612bfccc8ace909f67a476ea9dc594d

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