#!/usr/local/bin/perl # # 5/1999 J.E. Klasek jk AT auto tuwien ac at # # V 1.0 # # Description: # Get remote time from TCP/IP time service # # Syntax: # check_time [-v] [server] # # Parameter: # -v be verbose # # Exit status: # 0 ok, server process responded # <>0 server or server process not reachable/existing # # Revisions: # 2010-12-28 J.E. Klasek # Fixed: recv() return value handling. # Beautified. use Socket; $timeout = 10; # timeout for server response $port = "time"; # time server port # argument parsing while ( $_ = $ARGV[0], /^-/ ) { shift; # if (/^-o/) { # if ($ARGV[0]) { # $tm_file = $ARGV[0]; # shift; # next; # } # } /^-v/ && ( $verbose = 1, next ); usage: { print "Usage: $0 [-v][server]\n", <