mirror of
https://github.com/curl/curl.git
synced 2026-08-26 01:13:37 +03:00
lib: rename curlx_timediff to curlx_timeleft_ms
Rename `Curl_timeleft()` to `Curl_timeleft_ms()` to make the units in the returned `timediff_t` clear. (We used to always have ms there, but with QUIC started to sometimes calc ns as well). Rename some assigned vars without `_ms` suffix for clarity as well. Closes #19486
This commit is contained in:
parent
ca27404d27
commit
78a610cb83
53 changed files with 187 additions and 188 deletions
|
|
@ -1428,7 +1428,7 @@ static void win_update_sndbuf_size(struct cf_socket_ctx *ctx)
|
|||
DWORD ideallen;
|
||||
struct curltime n = curlx_now();
|
||||
|
||||
if(curlx_timediff(n, ctx->last_sndbuf_query_at) > 1000) {
|
||||
if(curlx_timediff_ms(n, ctx->last_sndbuf_query_at) > 1000) {
|
||||
if(!WSAIoctl(ctx->sock, SIO_IDEAL_SEND_BACKLOG_QUERY, 0, 0,
|
||||
&ideal, sizeof(ideal), &ideallen, 0, 0) &&
|
||||
ideal != ctx->sndbuf_size &&
|
||||
|
|
@ -1701,7 +1701,7 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
|
|||
return CURLE_OK;
|
||||
case CF_QUERY_CONNECT_REPLY_MS:
|
||||
if(ctx->got_first_byte) {
|
||||
timediff_t ms = curlx_timediff(ctx->first_byte_at, ctx->started_at);
|
||||
timediff_t ms = curlx_timediff_ms(ctx->first_byte_at, ctx->started_at);
|
||||
*pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
|
||||
}
|
||||
else
|
||||
|
|
@ -2020,7 +2020,7 @@ static timediff_t cf_tcp_accept_timeleft(struct Curl_cfilter *cf,
|
|||
{
|
||||
struct cf_socket_ctx *ctx = cf->ctx;
|
||||
timediff_t timeout_ms = DEFAULT_ACCEPT_TIMEOUT;
|
||||
timediff_t other;
|
||||
timediff_t other_ms;
|
||||
struct curltime now;
|
||||
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
|
|
@ -2030,14 +2030,14 @@ static timediff_t cf_tcp_accept_timeleft(struct Curl_cfilter *cf,
|
|||
|
||||
now = curlx_now();
|
||||
/* check if the generic timeout possibly is set shorter */
|
||||
other = Curl_timeleft(data, &now, FALSE);
|
||||
if(other && (other < timeout_ms))
|
||||
/* note that this also works fine for when other happens to be negative
|
||||
other_ms = Curl_timeleft_ms(data, &now, FALSE);
|
||||
if(other_ms && (other_ms < timeout_ms))
|
||||
/* note that this also works fine for when other_ms happens to be negative
|
||||
due to it already having elapsed */
|
||||
timeout_ms = other;
|
||||
timeout_ms = other_ms;
|
||||
else {
|
||||
/* subtract elapsed time */
|
||||
timeout_ms -= curlx_timediff(now, ctx->started_at);
|
||||
timeout_ms -= curlx_timediff_ms(now, ctx->started_at);
|
||||
if(!timeout_ms)
|
||||
/* avoid returning 0 as that means no timeout! */
|
||||
timeout_ms = -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue