summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-10-25 11:59:43 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-10-25 18:48:05 +0200
commit5d543fe90670c1924fd2c7d6be871b3ad90c438d (patch)
treed3d4f945d97ff52ab51c30b278f3d16e74e96883
parent1d72b5b8916e37191108b67ddfada2d1e1e00635 (diff)
downloadcurl-5d543fe90670c1924fd2c7d6be871b3ad90c438d.tar.gz
time: rename Curl_tvnow to Curl_now
... since the 'tv' stood for timeval and this function does not return a timeval struct anymore. Also, cleaned up the Curl_timediff*() functions to avoid typecasts and clean up the descriptive comments. Closes #2011
-rw-r--r--lib/asyn-ares.c4
-rw-r--r--lib/asyn-thread.c2
-rwxr-xr-xlib/connect.c8
-rw-r--r--lib/easy.c8
-rw-r--r--lib/file.c4
-rw-r--r--lib/ftp.c6
-rw-r--r--lib/hostip.c2
-rw-r--r--lib/multi.c12
-rw-r--r--lib/pingpong.c12
-rw-r--r--lib/pingpong.h4
-rw-r--r--lib/progress.c10
-rw-r--r--lib/rand.c2
-rw-r--r--lib/select.c8
-rw-r--r--lib/smtp.c2
-rw-r--r--lib/ssh.c2
-rw-r--r--lib/telnet.c4
-rw-r--r--lib/tftp.c2
-rw-r--r--lib/timeval.c28
-rw-r--r--lib/timeval.h4
-rw-r--r--lib/transfer.c8
-rw-r--r--lib/url.c14
-rw-r--r--lib/vtls/openssl.c8
-rw-r--r--tests/unit/unit1399.c2
23 files changed, 73 insertions, 83 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c
index 0fbf321b9..27523041e 100644
--- a/lib/asyn-ares.c
+++ b/lib/asyn-ares.c
@@ -355,7 +355,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
long timeout;
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
struct Curl_dns_entry *temp_entry;
if(entry)
@@ -400,7 +400,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
else {
- struct curltime now2 = Curl_tvnow();
+ struct curltime now2 = Curl_now();
timediff_t timediff = Curl_timediff(now2, now); /* spent time */
if(timediff <= 0)
timeout -= 1; /* always deduct at least 1 */
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index 96babb728..1ac3fc809 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -535,7 +535,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
}
else {
/* poll for name lookup done with exponential backoff up to 250ms */
- timediff_t elapsed = Curl_timediff(Curl_tvnow(),
+ timediff_t elapsed = Curl_timediff(Curl_now(),
data->progress.t_startsingle);
if(elapsed < 0)
elapsed = 0;
diff --git a/lib/connect.c b/lib/connect.c
index 7bf82d14a..5f545f230 100755
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -218,7 +218,7 @@ time_t Curl_timeleft(struct Curl_easy *data,
}
if(!nowp) {
- now = Curl_tvnow();
+ now = Curl_now();
nowp = &now;
}
@@ -737,7 +737,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
return CURLE_OK;
}
- now = Curl_tvnow();
+ now = Curl_now();
/* figure out how long time we have left to connect */
allow = Curl_timeleft(data, &now, TRUE);
@@ -1051,7 +1051,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
/* set socket non-blocking */
(void)curlx_nonblock(sockfd, TRUE);
- conn->connecttime = Curl_tvnow();
+ conn->connecttime = Curl_now();
if(conn->num_addr > 1)
Curl_expire(data, conn->timeoutms_per_addr, EXPIRE_DNS_PER_NAME);
@@ -1145,7 +1145,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
const struct Curl_dns_entry *remotehost)
{
struct Curl_easy *data = conn->data;
- struct curltime before = Curl_tvnow();
+ struct curltime before = Curl_now();
CURLcode result = CURLE_COULDNT_CONNECT;
time_t timeout_ms = Curl_timeleft(data, &before, TRUE);
diff --git a/lib/easy.c b/lib/easy.c
index 212d6f3da..018611927 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -586,12 +586,12 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
}
/* get the time stamp to use to figure out how long poll takes */
- before = Curl_tvnow();
+ before = Curl_now();
/* wait for activity or timeout */
pollrc = Curl_poll(fds, numfds, (int)ev->ms);
- after = Curl_tvnow();
+ after = Curl_now();
ev->msbump = FALSE; /* reset here */
@@ -680,12 +680,12 @@ static CURLcode easy_transfer(struct Curl_multi *multi)
int still_running = 0;
int rc;
- before = Curl_tvnow();
+ before = Curl_now();
mcode = curl_multi_wait(multi, NULL, 0, 1000, &rc);
if(!mcode) {
if(!rc) {
- struct curltime after = Curl_tvnow();
+ struct curltime after = Curl_now();
/* If it returns without any filedescriptor instantly, we need to
avoid busy-looping during periods where it has nothing particular
diff --git a/lib/file.c b/lib/file.c
index 7cfdab19f..0bbc0e180 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -404,7 +404,7 @@ static CURLcode file_upload(struct connectdata *conn)
if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
else
- result = Curl_speedcheck(data, Curl_tvnow());
+ result = Curl_speedcheck(data, Curl_now());
}
if(!result && Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
@@ -589,7 +589,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
else
- result = Curl_speedcheck(data, Curl_tvnow());
+ result = Curl_speedcheck(data, Curl_now());
}
if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
diff --git a/lib/ftp.c b/lib/ftp.c
index 905728778..e9fab4f53 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -341,7 +341,7 @@ static time_t ftp_timeleft_accept(struct Curl_easy *data)
if(data->set.accepttimeout > 0)
timeout_ms = data->set.accepttimeout;
- now = Curl_tvnow();
+ now = Curl_now();
/* check if the generic timeout possibly is set shorter */
other = Curl_timeleft(data, &now, FALSE);
@@ -3261,7 +3261,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
long old_time = pp->response_time;
pp->response_time = 60*1000; /* give it only a minute for now */
- pp->response = Curl_tvnow(); /* timeout relative now */
+ pp->response = Curl_now(); /* timeout relative now */
result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
@@ -3381,7 +3381,7 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
PPSENDF(&conn->proto.ftpc.pp, "%s", cmd);
- pp->response = Curl_tvnow(); /* timeout relative now */
+ pp->response = Curl_now(); /* timeout relative now */
result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
if(result)
diff --git a/lib/hostip.c b/lib/hostip.c
index 1f988e9ac..abe98028c 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -688,7 +688,7 @@ clean_up:
the time we spent until now! */
if(prev_alarm) {
/* there was an alarm() set before us, now put it back */
- timediff_t elapsed_secs = Curl_timediff(Curl_tvnow(),
+ timediff_t elapsed_secs = Curl_timediff(Curl_now(),
conn->created) / 1000;
/* the alarm period is counted in even number of seconds */
diff --git a/lib/multi.c b/lib/multi.c
index eb6a633a3..d5c6a3e83 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -2147,7 +2147,7 @@ CURLMcode curl_multi_perform(struct Curl_multi *multi, int *running_handles)
struct Curl_easy *data;
CURLMcode returncode = CURLM_OK;
struct Curl_tree *t;
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
if(!GOOD_MULTI_HANDLE(multi))
return CURLM_BAD_HANDLE;
@@ -2553,7 +2553,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
CURLMcode result = CURLM_OK;
struct Curl_easy *data = NULL;
struct Curl_tree *t;
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
if(checkall) {
/* *perform() deals with running_handles on its own */
@@ -2629,8 +2629,8 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
data = NULL; /* set data to NULL again to avoid calling
multi_runsingle() in case there's no need to */
- now = Curl_tvnow(); /* get a newer time since the multi_runsingle() loop
- may have taken some time */
+ now = Curl_now(); /* get a newer time since the multi_runsingle() loop
+ may have taken some time */
}
}
else {
@@ -2783,7 +2783,7 @@ static CURLMcode multi_timeout(struct Curl_multi *multi,
if(multi->timetree) {
/* we have a tree of expire times */
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
/* splay the lowest to the bottom */
multi->timetree = Curl_splay(tv_zero, multi->timetree);
@@ -2949,7 +2949,7 @@ void Curl_expire(struct Curl_easy *data, time_t milli, expire_id id)
DEBUGASSERT(id < EXPIRE_LAST);
- set = Curl_tvnow();
+ set = Curl_now();
set.tv_sec += milli/1000;
set.tv_usec += (unsigned int)(milli%1000)*1000;
diff --git a/lib/pingpong.c b/lib/pingpong.c
index 278405f72..438856a99 100644
--- a/lib/pingpong.c
+++ b/lib/pingpong.c
@@ -61,12 +61,12 @@ time_t Curl_pp_state_timeout(struct pingpong *pp)
/* Without a requested timeout, we only wait 'response_time' seconds for the
full response to arrive before we bail out */
timeout_ms = response_time -
- Curl_timediff(Curl_tvnow(), pp->response); /* spent time */
+ Curl_timediff(Curl_now(), pp->response); /* spent time */
if(data->set.timeout) {
/* if timeout is requested, find out how much remaining time we have */
timeout2_ms = data->set.timeout - /* timeout time */
- Curl_timediff(Curl_tvnow(), conn->now); /* spent time */
+ Curl_timediff(Curl_now(), conn->now); /* spent time */
/* pick the lowest number */
timeout_ms = CURLMIN(timeout_ms, timeout2_ms);
@@ -120,7 +120,7 @@ CURLcode Curl_pp_statemach(struct pingpong *pp, bool block)
if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
else
- result = Curl_speedcheck(data, Curl_tvnow());
+ result = Curl_speedcheck(data, Curl_now());
if(result)
return result;
@@ -143,7 +143,7 @@ void Curl_pp_init(struct pingpong *pp)
pp->nread_resp = 0;
pp->linestart_resp = conn->data->state.buffer;
pp->pending_resp = TRUE;
- pp->response = Curl_tvnow(); /* start response time-out now! */
+ pp->response = Curl_now(); /* start response time-out now! */
}
@@ -235,7 +235,7 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp,
free(s);
pp->sendthis = NULL;
pp->sendleft = pp->sendsize = 0;
- pp->response = Curl_tvnow();
+ pp->response = Curl_now();
}
return CURLE_OK;
@@ -499,7 +499,7 @@ CURLcode Curl_pp_flushsend(struct pingpong *pp)
free(pp->sendthis);
pp->sendthis = NULL;
pp->sendleft = pp->sendsize = 0;
- pp->response = Curl_tvnow();
+ pp->response = Curl_now();
}
return CURLE_OK;
}
diff --git a/lib/pingpong.h b/lib/pingpong.h
index a2c8ff592..5ac8df876 100644
--- a/lib/pingpong.h
+++ b/lib/pingpong.h
@@ -58,8 +58,8 @@ struct pingpong {
server */
size_t sendleft; /* number of bytes left to send from the sendthis buffer */
size_t sendsize; /* total size of the sendthis buffer */
- struct curltime response; /* set to Curl_tvnow() when a command has been sent
- off, used to time-out response reading */
+ struct curltime response; /* set to Curl_now() when a command has been sent
+ off, used to time-out response reading */
long response_time; /* When no timeout is given, this is the amount of
milliseconds we await for a server response. */
diff --git a/lib/progress.c b/lib/progress.c
index 03ab43c1c..72c518a14 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -161,7 +161,7 @@ void Curl_pgrsResetTransferSizes(struct Curl_easy *data)
*/
void Curl_pgrsTime(struct Curl_easy *data, timerid timer)
{
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
time_t *delta = NULL;
switch(timer) {
@@ -226,7 +226,7 @@ void Curl_pgrsTime(struct Curl_easy *data, timerid timer)
void Curl_pgrsStartNow(struct Curl_easy *data)
{
data->progress.speeder_c = 0; /* reset the progress meter display */
- data->progress.start = Curl_tvnow();
+ data->progress.start = Curl_now();
data->progress.is_t_startransfer_set = false;
data->progress.ul_limit_start.tv_sec = 0;
data->progress.ul_limit_start.tv_usec = 0;
@@ -285,7 +285,7 @@ long Curl_pgrsLimitWaitTime(curl_off_t cursize,
void Curl_pgrsSetDownloadCounter(struct Curl_easy *data, curl_off_t size)
{
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
data->progress.downloaded = size;
@@ -303,7 +303,7 @@ void Curl_pgrsSetDownloadCounter(struct Curl_easy *data, curl_off_t size)
void Curl_pgrsSetUploadCounter(struct Curl_easy *data, curl_off_t size)
{
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
data->progress.uploaded = size;
@@ -370,7 +370,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
curl_off_t total_estimate;
bool shownow = FALSE;
- now = Curl_tvnow(); /* what time is it */
+ now = Curl_now(); /* what time is it */
/* The time spent so far (from the start) */
data->progress.timespent = Curl_timediff_us(now, data->progress.start);
diff --git a/lib/rand.c b/lib/rand.c
index 2b08caf8c..2670af9d9 100644
--- a/lib/rand.c
+++ b/lib/rand.c
@@ -86,7 +86,7 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd)
#endif
if(!seeded) {
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
infof(data, "WARNING: Using weak random seed\n");
randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec;
randseed = randseed * 1103515245 + 12345;
diff --git a/lib/select.c b/lib/select.c
index e21fff1f0..d29868841 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -51,7 +51,7 @@
#include "warnless.h"
/* Convenience local macros */
-#define ELAPSED_MS() (int)Curl_timediff(Curl_tvnow(), initial_tv)
+#define ELAPSED_MS() (int)Curl_timediff(Curl_now(), initial_tv)
int Curl_ack_eintr = 0;
#define ERROR_NOT_EINTR(error) (Curl_ack_eintr || error != EINTR)
@@ -96,7 +96,7 @@ int Curl_wait_ms(int timeout_ms)
Sleep(timeout_ms);
#else
pending_ms = timeout_ms;
- initial_tv = Curl_tvnow();
+ initial_tv = Curl_now();
do {
#if defined(HAVE_POLL_FINE)
r = poll(NULL, 0, pending_ms);
@@ -184,7 +184,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
if(timeout_ms > 0) {
pending_ms = (int)timeout_ms;
- initial_tv = Curl_tvnow();
+ initial_tv = Curl_now();
}
#ifdef HAVE_POLL_FINE
@@ -425,7 +425,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
if(timeout_ms > 0) {
pending_ms = timeout_ms;
- initial_tv = Curl_tvnow();
+ initial_tv = Curl_now();
}
#ifdef HAVE_POLL_FINE
diff --git a/lib/smtp.c b/lib/smtp.c
index 08d8148a3..44ee2e9f8 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -1233,7 +1233,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
}
else {
/* Successfully sent so adjust the response timeout relative to now */
- pp->response = Curl_tvnow();
+ pp->response = Curl_now();
free(eob);
}
diff --git a/lib/ssh.c b/lib/ssh.c
index 5406bf073..e225ed297 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2834,7 +2834,7 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
while((sshc->state != SSH_STOP) && !result) {
bool block;
time_t left = 1000;
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
result = ssh_statemach_act(conn, &block);
if(result)
diff --git a/lib/telnet.c b/lib/telnet.c
index a5f87d81d..48b134ee3 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -1560,7 +1560,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
}
if(data->set.timeout) {
- now = Curl_tvnow();
+ now = Curl_now();
if(Curl_timediff(now, conn->created) >= data->set.timeout) {
failf(data, "Time-out");
result = CURLE_OPERATION_TIMEDOUT;
@@ -1678,7 +1678,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
} /* poll switch statement */
if(data->set.timeout) {
- now = Curl_tvnow();
+ now = Curl_now();
if(Curl_timediff(now, conn->created) >= data->set.timeout) {
failf(data, "Time-out");
result = CURLE_OPERATION_TIMEDOUT;
diff --git a/lib/tftp.c b/lib/tftp.c
index 4e599fd27..a47c24162 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -1293,7 +1293,7 @@ static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done)
if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
else
- result = Curl_speedcheck(conn->data, Curl_tvnow());
+ result = Curl_speedcheck(conn->data, Curl_now());
}
return result;
}
diff --git a/lib/timeval.c b/lib/timeval.c
index 6ed79ec60..4f630bafc 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -24,7 +24,7 @@
#if defined(WIN32) && !defined(MSDOS)
-struct curltime Curl_tvnow(void)
+struct curltime Curl_now(void)
{
/*
** GetTickCount() is available on _all_ Windows versions from W95 up
@@ -48,7 +48,7 @@ struct curltime Curl_tvnow(void)
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
-struct curltime Curl_tvnow(void)
+struct curltime Curl_now(void)
{
/*
** clock_gettime() is granted to be increased monotonically when the
@@ -86,7 +86,7 @@ struct curltime Curl_tvnow(void)
#elif defined(HAVE_GETTIMEOFDAY)
-struct curltime Curl_tvnow(void)
+struct curltime Curl_now(void)
{
/*
** gettimeofday() is not granted to be increased monotonically, due to
@@ -103,7 +103,7 @@ struct curltime Curl_tvnow(void)
#else
-struct curltime Curl_tvnow(void)
+struct curltime Curl_now(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
@@ -125,11 +125,8 @@ struct curltime Curl_tvnow(void)
#endif
/*
- * Make sure that the first argument is the more recent time, as otherwise
- * we'll get a weird negative time-diff back...
- *
- * Returns: the time difference in number of milliseconds. For large diffs it
- * returns 0x7fffffff on 32bit time_t systems.
+ * Returns: time difference in number of milliseconds. For too large diffs it
+ * returns max value.
*
* @unittest: 1323
*/
@@ -140,16 +137,12 @@ timediff_t Curl_timediff(struct curltime newer, struct curltime older)
return TIME_MAX;
else if(diff <= (TIME_MIN/1000))
return TIME_MIN;
- return (timediff_t)(newer.tv_sec-older.tv_sec)*1000+
- (timediff_t)(newer.tv_usec-older.tv_usec)/1000;
+ return diff * 1000 + (newer.tv_usec-older.tv_usec)/1000;
}
/*
- * Make sure that the first argument is the more recent time, as otherwise
- * we'll get a weird negative time-diff back...
- *
- * Returns: the time difference in number of microseconds. For too large diffs
- * it returns max value.
+ * Returns: time difference in number of microseconds. For too large diffs it
+ * returns max value.
*/
timediff_t Curl_timediff_us(struct curltime newer, struct curltime older)
{
@@ -158,6 +151,5 @@ timediff_t Curl_timediff_us(struct curltime newer, struct curltime older)
return TIME_MAX;
else if(diff <= (TIME_MIN/1000000))
return TIME_MIN;
- return (timediff_t)(newer.tv_sec-older.tv_sec)*1000000+
- (timediff_t)(newer.tv_usec-older.tv_usec);
+ return diff * 1000000 + newer.tv_usec-older.tv_usec;
}
diff --git a/lib/timeval.h b/lib/timeval.h
index b2f0e0d97..3821bfb73 100644
--- a/lib/timeval.h
+++ b/lib/timeval.h
@@ -30,13 +30,12 @@ typedef int timediff_t;
typedef ssize_t timediff_t;
#endif
-
struct curltime {
time_t tv_sec; /* seconds */
int tv_usec; /* microseconds */
};
-struct curltime Curl_tvnow(void);
+struct curltime Curl_now(void);
/*
* Make sure that the first argument (t1) is the more recent time and t2 is
@@ -55,4 +54,3 @@ timediff_t Curl_timediff(struct curltime t1, struct curltime t2);
timediff_t Curl_timediff_us(struct curltime newer, struct curltime older);
#endif /* HEADER_CURL_TIMEVAL_H */
-
diff --git a/lib/transfer.c b/lib/transfer.c
index 4bdbd5e18..c4cc16060 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -490,7 +490,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
Curl_pgrsTime(data, TIMER_STARTTRANSFER);
if(k->exp100 > EXP100_SEND_DATA)
/* set time stamp to compare with when waiting for the 100 */
- k->start100 = Curl_tvnow();
+ k->start100 = Curl_now();
}
*didwhat |= KEEP_RECV;
@@ -925,7 +925,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
go into the Expect: 100 state and await such a header */
k->exp100 = EXP100_AWAITING_CONTINUE; /* wait for the header */
k->keepon &= ~KEEP_SEND; /* disable writing */
- k->start100 = Curl_tvnow(); /* timeout count starts now */
+ k->start100 = Curl_now(); /* timeout count starts now */
*didwhat &= ~KEEP_SEND; /* we didn't write anything actually */
/* set a timeout for the multi interface */
@@ -1150,7 +1150,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
return result;
}
- k->now = Curl_tvnow();
+ k->now = Curl_now();
if(didwhat) {
/* Update read/write counters */
if(k->bytecountp)
@@ -2050,7 +2050,7 @@ Curl_setup_transfer(
(http->sending == HTTPSEND_BODY)) {
/* wait with write until we either got 100-continue or a timeout */
k->exp100 = EXP100_AWAITING_CONTINUE;
- k->start100 = Curl_tvnow();
+ k->start100 = Curl_now();
/* Set a timeout for the multi interface. Add the inaccuracy margin so
that we don't fire slightly too early and get denied to run. */
diff --git a/lib/url.c b/lib/url.c
index 594160898..3a913dae8 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3465,7 +3465,7 @@ Curl_oldest_idle_connection(struct Curl_easy *data)
struct connectdata *conn_candidate = NULL;
struct connectbundle *bundle;
- now = Curl_tvnow();
+ now = Curl_now();
Curl_hash_start_iterate(&bc->hash, &iter);
@@ -3530,7 +3530,7 @@ find_oldest_idle_connection_in_bundle(struct Curl_easy *data,
(void)data;
- now = Curl_tvnow();
+ now = Curl_now();
curr = bundle->conn_list.head;
while(curr) {
@@ -3612,7 +3612,7 @@ static int call_disconnect_if_dead(struct connectdata *conn,
*/
static void prune_dead_connections(struct Curl_easy *data)
{
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
time_t elapsed = Curl_timediff(now, data->state.conn_cache->last_cleanup);
if(elapsed >= 1000L) {
@@ -4385,7 +4385,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
connclose(conn, "Default to force-close");
/* Store creation time to help future close decision making */
- conn->created = Curl_tvnow();
+ conn->created = Curl_now();
conn->data = data; /* Setup the association between this connection
and the Curl_easy */
@@ -7128,7 +7128,7 @@ CURLcode Curl_setup_conn(struct connectdata *conn,
/* set start time here for timeout purposes in the connect procedure, it
is later set again for the progress meter purpose */
- conn->now = Curl_tvnow();
+ conn->now = Curl_now();
if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) {
conn->bits.tcpconnect[FIRSTSOCKET] = FALSE;
@@ -7145,7 +7145,7 @@ CURLcode Curl_setup_conn(struct connectdata *conn,
Curl_verboseconnect(conn);
}
- conn->now = Curl_tvnow(); /* time this *after* the connect is done, we
+ conn->now = Curl_now(); /* time this *after* the connect is done, we
set this here perhaps a second time */
#ifdef __EMX__
@@ -7236,7 +7236,7 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn)
HTTP. */
data->set.httpreq = HTTPREQ_GET;
- k->start = Curl_tvnow(); /* start time */
+ k->start = Curl_now(); /* start time */
k->now = k->start; /* current time is now */
k->header = TRUE; /* assume header */
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 96374dc10..3ed265f81 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -446,14 +446,14 @@ static CURLcode Curl_ossl_seed(struct Curl_easy *data)
size_t len = sizeof(randb);
size_t i, i_max;
for(i = 0, i_max = len / sizeof(struct curltime); i < i_max; ++i) {
- struct curltime tv = Curl_tvnow();
+ struct curltime tv = Curl_now();
Curl_wait_ms(1);
tv.tv_sec *= i + 1;
tv.tv_usec *= (unsigned int)i + 2;
- tv.tv_sec ^= ((Curl_tvnow().tv_sec + Curl_tvnow().tv_usec) *
+ tv.tv_sec ^= ((Curl_now().tv_sec + Curl_now().tv_usec) *
(i + 3)) << 8;
- tv.tv_usec ^= (unsigned int) ((Curl_tvnow().tv_sec +
- Curl_tvnow().tv_usec) *
+ tv.tv_usec ^= (unsigned int) ((Curl_now().tv_sec +
+ Curl_now().tv_usec) *
(i + 4)) << 16;
memcpy(&randb[i * sizeof(struct curltime)], &tv,
sizeof(struct curltime));
diff --git a/tests/unit/unit1399.c b/tests/unit/unit1399.c
index 91fd3dae1..897a34319 100644
--- a/tests/unit/unit1399.c
+++ b/tests/unit/unit1399.c
@@ -80,7 +80,7 @@ static void expect_timer_seconds(struct Curl_easy *data, int seconds)
* be 3 seconds. */
UNITTEST_START
struct Curl_easy data;
- struct curltime now = Curl_tvnow();
+ struct curltime now = Curl_now();
data.progress.t_nslookup = 0;
data.progress.t_connect = 0;