only refresh the screen for time every minute in console.pl
[spider.git] / perl / console.pl
index ceac24e278890d1275fa6f904761d1993355061e..8f028aa7ab9d7e8b2e9bde85e2386b1f66b8caf0 100755 (executable)
@@ -28,6 +28,7 @@ BEGIN {
 use Msg;
 use DXVars;
 use DXDebug;
+use DXUtil;
 use IO::File;
 use Curses;
 
@@ -176,7 +177,10 @@ sub show_screen
        }
     my $shl = @shistory;
        my $add = "-$spos-$shl";
-    $scr->addstr(LINES()-4, 0, '-' x (COLS() - (length($call) + length($add))));
+    my $time = ztime(time);
+       my $str =  "-" . $time . '-' x (COLS() - (length($call) + length($add) + length($time) + 1));
+       $scr->addstr(LINES()-4, 0, $str);
+       
        $scr->attrset($mycallcolor) if $has_colors;
        $scr->addstr("$call");
        $scr->attrset(COLOR_PAIR(0)) if $has_colors;
@@ -188,9 +192,11 @@ sub show_screen
 # add a line to the end of the top screen
 sub addtotop
 {
-       my $inbuf = shift;
-       push @shistory, $inbuf;
-       shift @shistory if @shistory > $maxshist;
+       while (@_) {
+               my $inbuf = shift;
+               push @shistory, $inbuf;
+               shift @shistory if @shistory > $maxshist;
+       }
        show_screen();
 }
 
@@ -424,15 +430,21 @@ $conn->send_now("I$call|set/nobeep");
 
 Msg->set_event_handler(\*STDIN, "read" => \&rec_stdin);
 
+my $lastmin = 0;
 for (;;) {
        my $t;
        Msg->event_loop(1, 1);
-       $top->refresh() if $top->is_wintouched;
-       $bot->refresh();
        $t = time;
        if ($t > $lasttime) {
+               my ($min)= (gmtime($t))[1];
+               if ($min != $lastmin) {
+                       show_screen();
+                       $lastmin = $min;
+               }
                $lasttime = $t;
        }
+       $top->refresh() if $top->is_wintouched;
+       $bot->refresh();
 }
 
 exit(0);