mirror of
https://github.com/curl/curl.git
synced 2026-05-30 11:27:29 +03:00
examples/chkspeed: portable printing when outputting curl_off_t values
Closes #19112
This commit is contained in:
parent
0217aca9f3
commit
e4ec666a3d
1 changed files with 8 additions and 6 deletions
|
|
@ -184,20 +184,22 @@ int main(int argc, char *argv[])
|
|||
/* check for bytes downloaded */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Data downloaded: %lu bytes.\n", (unsigned long)val);
|
||||
printf("Data downloaded: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", val);
|
||||
|
||||
/* check for total download time */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_TOTAL_TIME_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Total download time: %lu.%06lu sec.\n",
|
||||
(unsigned long)(val / 1000000),
|
||||
(unsigned long)(val % 1000000));
|
||||
printf("Total download time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
val % 1000000);
|
||||
|
||||
/* check for average download speed */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Average download speed: %lu kbyte/sec.\n",
|
||||
(unsigned long)(val / 1024));
|
||||
printf("Average download speed: %"
|
||||
CURL_FORMAT_CURL_OFF_T " kbyte/sec.\n",
|
||||
val / 1024);
|
||||
|
||||
if(prtall) {
|
||||
/* check for name resolution time */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue