ntp client in python

Use ntplib:

The following should work on both Python 2 and 3:

import ntplib
from time import ctime
c = ntplib.NTPClient()
response = c.request('pool.ntp.org')
print(ctime(response.tx_time))

Output:

Fri Jul 28 01:30:53 2017

Leave a Comment