python脚本
只要是让你充钱的100%都是骗子,切记不要充1分钱!
马上要到双11了,有秒杀需求的应该需要做服务器时间同步,python初学者抛砖引玉写一段大家试用,适用于python3.x,需要安装win32api和requestspip install pypiwin32pip install requests#-*- coding:utf-8 -*-import timefrom datetime import datetimeimport requestsimport jsonimport win32apidef getTime(): url = 'https://a.jd.com//ajax/queryServerData.html' ret = requests.get(url).text js = json.loads(ret) return float(js)/1000def setSystemTime(): tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst = time.gmtime(getTime()) strTime = datetime.strftime(datetime.fromtimestamp(getTime()),'%Y-%m-%d %H:%M:%S.%f') msec = strTime win32api.SetSystemTime(tm_year, tm_mon, tm_wday, tm_mday, tm_hour, tm_min, tm_sec, int(msec))if __name__ == '__main__': setSystemTime() #运行一次后,在本条语句前加#注释后可以查看时间同步情况 print("京东时间:%s\n本地时间:%s"%(datetime.fromtimestamp(getTime()),datetime.now()))