aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-12-20 15:05:50 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-12-20 15:05:50 +0100
commit51d4885ca046654d37b6bdf31540180693e35e09 (patch)
treebd3f07eef71ec29b578bf24cc1040b49f5b2098f
parentce896875f89f66d8d1659d57e6d6f80c157c1071 (diff)
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.
-rw-r--r--lib/progress.c17
1 files 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;
}
}