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++.




$ include "seed7_05.s7i";
  include "gethttp.s7i";
 
const proc: main is func
  local
    var string: pageWithTime is "";
    var integer: posOfUTC is 0;
    var integer: posOfBR is 0;
    var string: timeStri is "";
  begin
    pageWithTime := getHttp("tycho.usno.navy.mil/cgi-bin/timer.pl");
    posOfUTC := pos(pageWithTime, "UTC");
    if posOfUTC <> 0 then
      posOfBR := rpos(pageWithTime, "<BR>", posOfUTC);
      if posOfBR <> 0 then
        timeStri := pageWithTime[posOfBR + 4 .. pred(posOfUTC)];
        writeln(timeStri);
      end if;
    end if;
  end func;