]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Net.pl
- new time delta function
[infobot.git] / src / Net.pl
index fb1959cebab756fec93b7918d8c991904192b964..09557c8388800ad72c80f4364df02ff71987785e 100644 (file)
@@ -22,10 +22,7 @@ sub ftpGet {
 ###    'BlockSize'     => 1024,        # ???
     );
 
-    if ($@) {
-       &ERROR("FTP: $@.");
-       return;
-    }
+    return if ($@);
 
     # login.
     if ($ftp->login()) {
@@ -57,7 +54,7 @@ sub ftpGet {
                &status("FTP: local size is $lsize; downloading.") if ($verbose_ftp);
            } else {
                &status("FTP: same size; skipping.");
-               &system("touch $thisfile");     # lame hack.
+               system("touch $thisfile");      # lame hack.
                $ftp->quit();
                return 1;
            }
@@ -68,7 +65,7 @@ sub ftpGet {
        return 0;
     }
 
-    my $start_time = &gettimeofday();
+    my $start_time     = &timeget();
     if (defined $lfile) {
        &status("FTP: getting $file as $lfile.") if ($verbose_ftp);
        $ftp->get($file,$lfile);
@@ -84,7 +81,7 @@ sub ftpGet {
        }
     }
 
-    my $delta_time = &gettimeofday() - $start_time;
+    my $delta_time     = &timedelta($start_time);
     if ($delta_time > 0 and $verbose_ftp) {
        &status(sprintf("FTP: %.02f sec to complete.", $delta_time));
        my ($rateunit,$rate) = ("B", $size / $delta_time);
@@ -110,10 +107,7 @@ sub ftpList {
     &status("FTP: opening connection to $host.") if ($verbose_ftp);
     my $ftp = Net::FTP->new($host,'Timeout'=>60);
 
-    if ($@) {
-###    &ERROR("FTP: $@.");
-       return;
-    }
+    return if ($@);
 
     # login.
     if ($ftp->login()) {