Created
September 8, 2018 06:56
-
-
Save zhangchunlin/9a65ad525f66deb35db10edcb5c5a661 to your computer and use it in GitHub Desktop.
ntp windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import ntplib | |
c = ntplib.NTPClient() | |
response = c.request('pool.ntp.org') | |
ts = response.tx_time | |
_date = time.strftime('%Y-%m-%d',time.localtime(ts)) | |
_time = time.strftime('%X',time.localtime(ts)) | |
os.system('date {} && time {}'.format(_date,_time)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment