aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-03-23 04:23:53 +0000
committerYang Tse <yangsita@gmail.com>2007-03-23 04:23:53 +0000
commit34afb0b2576c6220b16c1b4479fd5b9015a97113 (patch)
treeadd1175168eb2e521b63160c350233795909bb87 /lib
parent6bb9bd8b6975696397e27008b525c06da88a631f (diff)
Change spelling, ONE_TERRABYTE -> ONE_TERABYTE
Shave off a couple of function calls in the part of Curl_pgrsUpdate() which is always executed when called. Fix a couple of comments.
Diffstat (limited to 'lib')
-rw-r--r--lib/progress.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/progress.c b/lib/progress.c
index d59335971..9d9096069 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -71,8 +71,8 @@ static char *max5data(curl_off_t bytes, char *max5)
#define ONE_KILOBYTE 1024
#define ONE_MEGABYTE (1024* ONE_KILOBYTE)
#define ONE_GIGABYTE (1024* ONE_MEGABYTE)
-#define ONE_TERRABYTE ((curl_off_t)1024* ONE_GIGABYTE)
-#define ONE_PETABYTE ((curl_off_t)1024* ONE_TERRABYTE)
+#define ONE_TERABYTE ((curl_off_t)1024* ONE_GIGABYTE)
+#define ONE_PETABYTE ((curl_off_t)1024* ONE_TERABYTE)
if(bytes < 100000) {
snprintf(max5, 6, "%5" FORMAT_OFF_T, bytes);
@@ -101,9 +101,9 @@ static char *max5data(curl_off_t bytes, char *max5)
/* up to 10000GB, display without decimal: XXXXG */
snprintf(max5, 6, "%4dG", (int)(bytes/ONE_GIGABYTE));
- else if(bytes < (curl_off_t)10000 * ONE_TERRABYTE)
+ else if(bytes < (curl_off_t)10000 * ONE_TERABYTE)
/* up to 10000TB, display without decimal: XXXXT */
- snprintf(max5, 6, "%4dT", (int)(bytes/ONE_TERRABYTE));
+ snprintf(max5, 6, "%4dT", (int)(bytes/ONE_TERABYTE));
else {
/* up to 10000PB, display without decimal: XXXXP */
snprintf(max5, 6, "%4dP", (int)(bytes/ONE_PETABYTE));
@@ -249,7 +249,9 @@ int Curl_pgrsUpdate(struct connectdata *conn)
now = Curl_tvnow(); /* what time is it */
/* The time spent so far (from the start) */
- data->progress.timespent = Curl_tvdiff_secs(now, data->progress.start);
+ data->progress.timespent =
+ (double)(now.tv_sec - data->progress.start.tv_sec) +
+ (double)(now.tv_usec - data->progress.start.tv_usec)/1000000.0;
timespent = (long)data->progress.timespent;
/* The average download speed this far */
@@ -263,12 +265,12 @@ int Curl_pgrsUpdate(struct connectdata *conn)
(data->progress.timespent>0?data->progress.timespent:1));
/* Calculations done at most once a second, unless end is reached */
- if(data->progress.lastshow != Curl_tvlong(now)) {
+ if(data->progress.lastshow != (long)now.tv_sec) {
data->progress.lastshow = now.tv_sec;
/* Let's do the "current speed" thing, which should use the fastest
- of the dl/ul speeds. Store the fasted speed at entry 'nowindex'. */
+ of the dl/ul speeds. Store the faster speed at entry 'nowindex'. */
data->progress.speeder[ nowindex ] =
data->progress.downloaded>data->progress.uploaded?
data->progress.downloaded:data->progress.uploaded;
@@ -377,7 +379,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
(data->progress.size_dl/100));
}
- /* Now figure out which of them that is slower and use for the for
+ /* Now figure out which of them is slower and use that one for the
total estimate! */
total_estimate = ulestimate>dlestimate?ulestimate:dlestimate;