Task

Create a program that downloads the time from this URL:   http://tycho.usno.navy.mil/cgi-bin/timer.pl   and then prints the current UTC time by extracting just the UTC time from the web page's HTML. Alternatively, if the above url is not working, grab the first date/time off this page's talk page.



If possible, only use libraries that come at no extra monetary cost with the programming language and that are widely available and popular such as CPAN for Perl or Boost for C++.




Public Sub Main()
Dim sWeb, sTemp, sOutput As String                                          'Variables
 
Shell "wget -O /tmp/web http://tycho.usno.navy.mil/cgi-bin/timer.pl" Wait   'Use 'wget' to save the web file in /tmp/
 
sWeb = File.Load("/tmp/web")                                                'Open file and store in sWeb
 
For Each sTemp In Split(sWeb, gb.NewLine)                                   'Split the file by NewLines..
  If InStr(sTemp, "UTC") Then                                               'If the line contains "UTC" then..
    sOutPut = sTemp                                                         'Extract the line into sOutput
    Break                                                                   'Get out of here
  End If
Next
 
Print Mid(sOutput, 5)                                                       'Print the result without the '<BR>' tag
 
End