diff --git a/lib/progress.c b/lib/progress.c index 1514e1edd..6abe72e56 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -157,6 +157,8 @@ void Curl_pgrsResetTimes(struct SessionHandle *data) void Curl_pgrsTime(struct SessionHandle *data, timerid timer) { + struct timeval now = Curl_tvnow(); + switch(timer) { default: case TIMER_NONE: @@ -164,35 +166,34 @@ void Curl_pgrsTime(struct SessionHandle *data, timerid timer) break; case TIMER_STARTSINGLE: /* This is set at the start of a single fetch */ - data->progress.t_startsingle = Curl_tvnow(); + data->progress.t_startsingle = now; break; case TIMER_NAMELOOKUP: data->progress.t_nslookup = - Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + Curl_tvdiff_secs(now, data->progress.t_startsingle); break; case TIMER_CONNECT: data->progress.t_connect = - Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + Curl_tvdiff_secs(now, data->progress.t_startsingle); break; case TIMER_APPCONNECT: data->progress.t_appconnect = - Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + Curl_tvdiff_secs(now, data->progress.t_startsingle); break; case TIMER_PRETRANSFER: data->progress.t_pretransfer = - Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + Curl_tvdiff_secs(now, data->progress.t_startsingle); break; case TIMER_STARTTRANSFER: data->progress.t_starttransfer = - Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + Curl_tvdiff_secs(now, data->progress.t_startsingle); break; case TIMER_POSTRANSFER: /* this is the normal end-of-transfer thing */ break; case TIMER_REDIRECT: - data->progress.t_redirect = - Curl_tvdiff_secs(Curl_tvnow(), data->progress.start); + data->progress.t_redirect = Curl_tvdiff_secs(now, data->progress.start); break; } }