Skip to content

Commit

Permalink
Merge pull request #1742 from davidBar-On/iperf_time_add_usecs-perfor…
Browse files Browse the repository at this point in the history
…mance-improve

iperf_time_add() optimization
  • Loading branch information
bmah888 authored Aug 26, 2024
2 parents 67ca2c8 + e9e49c4 commit 5bf93d6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/iperf_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ iperf_time_now(struct iperf_time *time1)
void
iperf_time_add_usecs(struct iperf_time *time1, uint64_t usecs)
{
time1->secs += usecs / 1000000L;
time1->usecs += usecs % 1000000L;
if ( time1->usecs >= 1000000L ) {
time1->secs += time1->usecs / 1000000L;
time1->usecs %= 1000000L;
}
uint64_t total_usecs;

total_usecs = time1->usecs + usecs;
time1->secs += total_usecs / 1000000L;
time1->usecs = total_usecs % 1000000L;
}

uint64_t
Expand Down

0 comments on commit 5bf93d6

Please sign in to comment.