Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iperf_time_add() optimization #1742

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading