use Time::Local;
@ipconf = `ipconfig`;
foreach $line (@ipconf) {
chomp($line);
if($line =~ /IPv4/) {
@ldata = split(/\s+/, $line);
print "IP Address is $ldata[$#ldata].\n";
}
}
@nettime = `net time`;
foreach $k (@nettime) {
chomp($k);
next if($k !~ /^Current/);
@ldata = split(/\s+/, $k);
$date = $ldata[5];
$ntime = $ldata[6];
$ampm = $ldata[7];
($mon, $day, $year) = split('/', $date);
($hour, $min, $sec) = split(':', $ntime);
$mon--;
$hour += 12 if($ampm eq 'PM');
$seconds = timelocal($sec, $min, $hour, $day, $mon, $year);
$now = time;
$diff = abs($now - $seconds);
print "The difference in time between the server and local machine is $diff seconds.\n";
}
$notepad = 'C:/program files (x86)/notepad++/notepad++';
$arg = 'K:/perl/lab12/lab12.pl';
$retval = system($notepad, $arg);
if($retval == 0) {
print "Return value is good.\n";
}else{
print "Bad return value\n";
}
exit;