37 lines
1000 B
Plaintext
37 lines
1000 B
Plaintext
/* 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()
|