Skip to main content

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/.

Release files for ntplib 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ntplib 0.4.0
File Size Uploaded
ntplib-0.4.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ntplib 0.4.0
File Interpreter ABI Platform
ntplib-0.4.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 14.0 kB

Release files / ntplib-0.4.0.tar.gz

Download URL ntplib-0.4.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
899d8fb5f8c2555213aea95efca02934c7343df6ace9d7628a5176b176906267
BLAKE2b-256 checksum
How to use checksums
b4146b018fb602602d9f6cc7485cbad7c1be3a85d25cea18c233854f05284aed
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ntplib-0.4.0-py2.py3-none-any.whl

Download URL ntplib-0.4.0-py2.py3-none-any.whl
Size 6.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8d27375329ed7ff38755f7b6d4658b28edc147cadf40338a63a0da8133469d60
BLAKE2b-256 checksum
How to use checksums
588c41da70f6feaca807357206a376b6de2001b439c7f78f53473a914a6dbd1e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.4

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page