|
- Dim SvrName(14),xPost,HttpAdd,NowTime,StartTime
- StartTime=Now
- //驗證服務器
- SvrName(1) = "time-nw.nist.gov"
- //Microsoft, Redmond, Washington 131.107.1.10
- SvrName(2) = "time-a.nist.gov"
- //NIST, Gaithersburg, Maryland 129.6.15.28
- SvrName(3) = "time-b.nist.gov"
- //NIST, Gaithersburg, Maryland 129.6.15.29
- SvrName(4) = "time-a.timefreq.bldrdoc.gov"
- //NIST, Boulder, Colorado 132.163.4.101
- SvrName(5) = "time-b.timefreq.bldrdoc.gov"
- //NIST, Boulder, Colorado 132.163.4.102
- SvrName(6) = "time-c.timefreq.bldrdoc.gov"
- //NIST, Boulder, Colorado 132.163.4.103
- SvrName(7) = "utcnist.colorado.edu"
- //University of Colorado, Boulder 128.138.140.44
- SvrName(8) = "time.nist.gov"
- //NCAR, Boulder, Colorado 192.43.244.18
- SvrName(9) = "nist1.datum.com"
- //Datum, San Jose, California 66.243.43.21
- SvrName(10) = "nist1.dc.glassey.com"
- //Abovenet, Virginia 216.200.93.8
- SvrName(11) = "nist1.ny.glassey.com"
- //Abovenet, New York City 208.184.49.9
- SvrName(12) = "nist1.sj.glassey.com"
- //Abovenet, San Jose, California 207.126.103.204
- SvrName(13) = "nist1.aol-ca.truetime.com"
- //TrueTime, AOL facility, Sunnyvale, CA 207.200.81.113
- SvrName(14) = "nist1.aol-va.truetime.com"
- //TrueTime, AOL facility, Virginia 205.188.185.33
- //調用XMLHTTP
- Set xPost=createObject("Microsoft.XMLHTTP")
- Set Obj=createObject("Wscript.shell")
- While NowTime=""
- i=1
- For 14
- HttpAdd="Http://"&SvrName(i)&":13":NowTime=""
- xPost.Open "ut",HttpAdd,False
- //以同步方式打開此連接
- xPost.Send()
- //送請求到http服務器並接收回應
- Delay 10
- //適當延時以接收數據
- If xPost.readyState=4
- //如果獲得數據完畢OR連接超時
- NowTime=mid(xPost.responsetext,8,17)
- //以字符串返回響應信息
- If NowTime<>""
- NowTime=CDate(NowTime) + 8 / 24
- Obj.popup "當前標准時間:"&NowTime,0,"網絡時間"
- Goto EndConnect
- Else
- xPost.abort()
- NowTime=""
- EndIf
- EndIf
- i=i+1
- EndFor
- //如果一定時間沒有連接上,說明出暸問題
- If DateDiff("s",StartTime,Now)>=30 And NowTime=""
- Obj.popup "請確定妳已經連接上暸互聯網!",0,"網絡時間"
- Goto EndConnect
- EndIf
- EndWhile
- Rem EndConnect
- xPost.abort()
- Set xPost=Nothing
- NowTime=""
|
|