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




/* NetRexx */
options replace format comments java crossref symbols binary
 
parse arg full_short .
if 'FULL'.abbrev(full_short.upper(), 1) then
  dateFull = isTrue()
else
  dateFull = isFalse()
do
  timeURL = java.net.URL('http://tycho.usno.navy.mil/cgi-bin/timer.pl')
  conn = timeURL.openConnection()
  ibr = BufferedReader(InputStreamReader(conn.getInputStream()))
  line = Rexx
  loop label readLoop while ibr.ready()
    line = ibr.readLine()
    if line = null then leave readLoop
    line = line.translate(' ', '\t')
    if line.wordpos('UTC') > 0 then do
      parse line . '>'       udatetime 'UTC' . -
            0    . '>' . ',' utime     'UTC' .
      if dateFull then
        say udatetime.strip() 'UTC'
      else
        say utime.strip()
      leave readLoop
      end
    end readLoop
  ibr.close()
catch ex = IOException
  ex.printStackTrace()
end
 
method isTrue() public constant returns boolean
  return 1 == 1
method isFalse() public constant returns boolean
  return \isTrue()
 