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.19 by tdb, Thu Dec 11 14:27:08 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 452 | Line 454 | int main(int argc, char **argv){
454                                          fprintf(stderr, "Time must be 1 second or greater\n");
455                                          exit(1);
456                                  }
455                                delay--;
457                                  break;
458                          case 'v':
459                                  version_num(argv[0]);  
# Line 462 | Line 463 | int main(int argc, char **argv){
463                                  usage(argv[0]);
464                                  return 1;
465                                  break;
465                                
466                  }
467          }
468  
# Line 484 | Line 484 | int main(int argc, char **argv){
484          display_headings();
485  
486          for(;;){
487 +                time_t now;
488                  int ch = getch();
489 +
490                  if (ch == 'q'){
491 <                        endwin();
490 <                        return 0;
491 >                        break;
492                  }
493  
494 <                get_stats();
494 >                /* To keep the numbers slightly accurate we do not want them
495 >                 * updating more frequently than once a second.
496 >                 */
497 >                now = time(NULL);
498 >                if ((now - last_update) >= 1) {
499 >                        get_stats();
500 >                }
501 >                last_update = now;
502  
503                  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);
504          }      
505  
506          endwin();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines