mirror of
https://github.com/nmap/nmap.git
synced 2025-12-26 01:19:03 +00:00
Minor efficiencies: avoid multiple expansions of function calls in TIMEVAL_* macros
This commit is contained in:
@@ -301,17 +301,18 @@ bool keyWasPressed()
|
||||
option. */
|
||||
if (o.stats_interval != 0.0) {
|
||||
struct timeval now;
|
||||
time_t usec_interval = o.stats_interval * 1000000;
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
if (stats_time.tv_sec == 0) {
|
||||
/* Initialize the scheduled stats time. */
|
||||
stats_time = *o.getStartTime();
|
||||
TIMEVAL_ADD(stats_time, stats_time, (time_t) (o.stats_interval * 1000000));
|
||||
TIMEVAL_ADD(stats_time, stats_time, usec_interval);
|
||||
}
|
||||
|
||||
if (TIMEVAL_AFTER(now, stats_time)) {
|
||||
/* Advance to the next print time. */
|
||||
TIMEVAL_ADD(stats_time, stats_time, (time_t) (o.stats_interval * 1000000));
|
||||
TIMEVAL_ADD(stats_time, stats_time, usec_interval);
|
||||
/* If it's still in the past, catch it up to the present,
|
||||
* plus half a second to avoid double-printing without any progress. */
|
||||
if (TIMEVAL_AFTER(now, stats_time))
|
||||
|
||||
Reference in New Issue
Block a user