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.17 by ats, Fri Nov 7 18:38:48 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();
494                          return 0;
495                  }
496  
497 <                get_stats();
497 >                /* To keep the numbers slightly accurate we do not want them
498 >                 * updating more frequently than once a second.
499 >                 */
500 >                now = time(NULL);
501 >                if ((now - last_update) >= 1) {
502 >                        get_stats();
503 >                }
504 >                last_update = now;
505  
506                  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);
507          }      
508  
509          endwin();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines