| 428 |
|
extern int optind; |
| 429 |
|
int c; |
| 430 |
|
|
| 431 |
+ |
time_t last_update = 0; |
| 432 |
+ |
|
| 433 |
|
WINDOW *window; |
| 434 |
|
|
| 435 |
|
extern int errno; |
| 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(); |