0
点赞
收藏
分享

微信扫一扫

python ntp客户端校时

NicoalsNC 2022-08-09 阅读 53
编程语言

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))

举报

相关推荐

0 条评论