ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/saidar/saidar.c
(Generate patch)

Comparing projects/libstatgrab/src/saidar/saidar.c (file contents):
Revision 1.16 by ats, Fri Nov 7 18:28:05 2003 UTC vs.
Revision 1.18 by ats, Fri Nov 7 18:39:39 2003 UTC

# Line 428 | Line 428 | int main(int argc, char **argv){
428          extern int optind;
429          int c;
430  
431 +        time_t last_update = 0;
432 +
433          WINDOW *window;
434  
435          extern int errno;
# Line 484 | Line 486 | int main(int argc, char **argv){
486          display_headings();
487  
488          for(;;){
489 +                time_t now;
490                  int ch = getch();
491 +
492                  if (ch == 'q'){
493 <                        endwin();
490 <                        return 0;
493 >                        break;
494                  }
495  
496 <                get_stats();
496 >                /* To keep the numbers slightly accurate we do not want them
497 >                 * updating more frequently than once a second.
498 >                 */
499 >                now = time(NULL);
500 >                if ((now - last_update) >= 1) {
501 >                        get_stats();
502 >                }
503 >                last_update = now;
504  
505                  display_data();
496
497                /* To keep the numbers slightly accurate we do not want them updating more
498                 * frequently than once a second.
499                 */
500                sleep(1);
506          }      
507  
508          endwin();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines