本帖最后由 gamewfj 于 2018-4-15 18:26 编辑
注册52小4年了,还是一级,惭愧啊
AU3菜鸟,根据XMLHTTP返回报文头部里的GMT时间来获取时间
能力有限,正则很垃圾,勉强能用。就是从Date: Sun, 15 Apr 2018 10:12:34 GMT 这句里获取时间
设置时间是AU3自带的UDF,需已管理员权限才能设置时间,win10刚才测试通过
AU3编译的程序报毒正常,不建议下载。
百度校时.rar
(429.07 KB, 下载次数: 52)
建议自己安装AU3程序自己编译以下源代码
[Asm] 纯文本查看 复制代码
#include <Date.au3>
$oHTTP = ObjCreate("Msxml2.xmlhttp")
If [url=home.php?mod=space&uid=209627]@Error[/url] Then Exit
_xiaozheng('https://www.baidu.com')
Func _xiaozheng($url)
$oHTTP.open("GET", $url, False)
$oHTTP.getAllResponseHeaders()
$oHTTP.send
ConsoleWrite($oHTTP.getAllResponseHeaders())
$time = StringRegExp($oHTTP.getAllResponseHeaders(), 'Date.*?(\d+)\:(\d+)\:(\d+)', 3)
If Not @error Then
_SetTime($time[0] + 8, $time[1], $time[2])
If @error Then
MsgBox(4096, '校正', '系统时间校正失败', '')
Else
MsgBox(0, '校正', '系统时间已校正为:' & $time[0] + 8 & ':' & $time[1] & ':' & $time[2])
EndIf
EndIf
EndFunc ;==>_xiaozheng
获取到HTTP get 百度的信息头如下
[HTML] 纯文本查看 复制代码 Bdpagetype: 1
Bdqid: 0xe5f724810004bec4
Bduserid: 0
Cache-Control: private
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
Cxy_all: baidu+3e1b4aa5bd08d7beb3de6ae3795ea4d9
Date: Sun, 15 Apr 2018 10:12:34 GMT
Expires: Sun, 15 Apr 2018 10:12:34 GMT
Server: BWS/1.1
Set-Cookie: BDSVRTM=9; path=/
Set-Cookie: BD_HOME=0; path=/
Set-Cookie: H_PS_PSSID=1434_21081_26105; path=/; domain=.baidu.com
Strict-Transport-Security: max-age=172800
X-Powered-By: HPHP
X-Ua-Compatible: IE=Edge,chrome=1
Transfer-Encoding: chunked |