python ntp客戶端校時
import os
import time
import ntplib
c = ntplib.NTPClient()
response = c.request('10.2.15.168')
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))
posted on 2018-01-31 16:08 AlanTop 閱讀(586) 評論(0) 編輯 收藏 引用 所屬分類: Python

