峰云教育网
您的当前位置:首页python修改操作系统时间的方法

python修改操作系统时间的方法

来源:峰云教育网


本文实例讲述了python修改操作系统时间的方法。分享给大家供大家参考。具体实现方法如下:

#-*- coding:utf-8 -*-
import socket
import struct
import time
import win32api
TimeServer = '210.72.145.44' #国家授时中心ip
Port = 123
def getTime():
 TIME_1970 = 22088800L
 client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 data = 'x1b' + 47 * '