From 51d4885ca046654d37b6bdf31540180693e35e09 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 20 Dec 2011 15:05:50 +0100 Subject: [PATCH] Curl_pgrsTime: store now in an auto variable It makes it easier to introduce debug outputs in this function, and everything in the function is using the value anyway so it might even be more efficient. --- lib/progress.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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; } }