Skip to content

Instantly share code, notes, and snippets.

@zhangchunlin
Created September 8, 2018 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangchunlin/9a65ad525f66deb35db10edcb5c5a661 to your computer and use it in GitHub Desktop.
Save zhangchunlin/9a65ad525f66deb35db10edcb5c5a661 to your computer and use it in GitHub Desktop.
ntp windows
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