38 lines
1 KiB
Text
38 lines
1 KiB
Text
' Assuming WGET is installed
|
|
Dim sContent$, sUTC$, sRFC850$, tmpFile$, cmd$, linea$
|
|
|
|
tmpFile$ = Environ$("TEMP") + "\utctime.html"
|
|
cmd$ = "wget -q -O " + tmpFile$ + " https://www.utctime.net"
|
|
|
|
Print "Download with wget..."
|
|
Shell _Hide cmd$
|
|
|
|
' Read file
|
|
If _FileExists(tmpFile$) Then
|
|
Open tmpFile$ For Input As #1
|
|
sContent$ = ""
|
|
While Not EOF(1)
|
|
Line Input #1, linea$
|
|
sContent$ = sContent$ + linea$ + Chr$(10)
|
|
Wend
|
|
Close #1
|
|
Kill tmpFile$
|
|
End If
|
|
|
|
' Extract UTC and RFC 850
|
|
utcStart = InStr(sContent$, "UTC</td><td>")
|
|
If utcStart > 0 Then
|
|
utcStart = utcStart + 12
|
|
utcEnd = InStr(utcStart, sContent$, "</td>")
|
|
If utcEnd > 0 Then sUTC$ = RTrim$(Mid$(sContent$, utcStart, utcEnd - utcStart))
|
|
End If
|
|
|
|
rfcStart = InStr(sContent$, "RFC 850</td><td>")
|
|
If rfcStart > 0 Then
|
|
rfcStart = rfcStart + 16
|
|
rfcEnd = InStr(rfcStart, sContent$, "</td>")
|
|
If rfcEnd > 0 Then sRFC850$ = RTrim$(Mid$(sContent$, rfcStart, rfcEnd - rfcStart))
|
|
End If
|
|
|
|
Print "UTC: "; sUTC$
|
|
Print "RFC 850: "; sRFC850$
|