First you need to install Ntplib, section one through PIP installation.
Ubuntu next section one installs the PIP via the following instructions:
$ sudo apt-get install Python-pip
Install ntplib using the following instructions:
$ sudo pip install Ntplib
Find Pip is really a good thing, before downloading an outside Python library is very troublesome, now with the PIP on the line, feel more convenient than the Java maven.
The following code relies on Ntplib to request the current time and print to an NTP server through the network Time protocol, or NTP.
Code:
#/usr/bin/env pythonImportNtplib fromTimeImportCTimedefprint_time (): Ntp_client=Ntplib. NTPClient () Response= Ntp_client.request ('pool.ntp.org') PrintCTime (response.tx_time)if __name__=='__main__': Print_time ()
View Code
Python gets and prints the current time from the network time server and an experience with PIP installation Ntplib