]> granicus.if.org Git - curl/commitdiff
getinfo: add microsecond precise timers for various intervals
authorPhilip Prindeville <philipp@redfish-solutions.com>
Thu, 17 May 2018 11:37:36 +0000 (13:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 17 May 2018 11:41:04 +0000 (13:41 +0200)
Provide a set of new timers that return the time intervals using integer
number of microseconds instead of floats.

The new info names are as following:

CURLINFO_APPCONNECT_TIME_T
CURLINFO_CONNECT_TIME_T
CURLINFO_NAMELOOKUP_TIME_T
CURLINFO_PRETRANSFER_TIME_T
CURLINFO_REDIRECT_TIME_T
CURLINFO_STARTTRANSFER_TIME_T
CURLINFO_TOTAL_TIME_T

Closes #2495

23 files changed:
docs/examples/chkspeed.c
docs/examples/fileupload.c
docs/examples/progressfunc.c
docs/libcurl/curl_easy_getinfo.3
docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3
docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 [new file with mode: 0644]
docs/libcurl/opts/CURLINFO_CONNECT_TIME.3
docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3 [new file with mode: 0644]
docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3
docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 [new file with mode: 0644]
docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3
docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3 [new file with mode: 0644]
docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3
docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 [new file with mode: 0644]
docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3
docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3 [new file with mode: 0644]
docs/libcurl/opts/CURLINFO_TOTAL_TIME.3
docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 [new file with mode: 0644]
docs/libcurl/opts/Makefile.inc
docs/libcurl/symbols-in-versions
include/curl/curl.h
lib/getinfo.c
tests/libtest/lib500.c

index f3dd1e94467f64cb2128321857541c47b25049fd..0b0ba72a0ba4b03249ec25f6dd56debd500e0d6c 100644 (file)
@@ -165,33 +165,37 @@ int main(int argc, char *argv[])
   res = curl_easy_perform(curl_handle);
 
   if(CURLE_OK == res) {
-    double val;
+    curl_off_t val;
 
     /* check for bytes downloaded */
-    res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD, &val);
+    res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD_T, &val);
     if((CURLE_OK == res) && (val>0))
-      printf("Data downloaded: %0.0f bytes.\n", 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, &val);
+    res = curl_easy_getinfo(curl_handle, CURLINFO_TOTAL_TIME_T, &val);
     if((CURLE_OK == res) && (val>0))
-      printf("Total download time: %0.3f sec.\n", val);
+      printf("Total download time: %" CURL_FORMAT_CURL_OFF_T ".%06ld sec.\n",
+             (val / 1000000), (long)(val % 1000000));
 
     /* check for average download speed */
-    res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD, &val);
+    res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD_T, &val);
     if((CURLE_OK == res) && (val>0))
-      printf("Average download speed: %0.3f kbyte/sec.\n", val / 1024);
+      printf("Average download speed: %" CURL_FORMAT_CURL_OFF_T
+             " kbyte/sec.\n", val / 1024);
 
     if(prtall) {
       /* check for name resolution time */
-      res = curl_easy_getinfo(curl_handle, CURLINFO_NAMELOOKUP_TIME, &val);
+      res = curl_easy_getinfo(curl_handle, CURLINFO_NAMELOOKUP_TIME_T, &val);
       if((CURLE_OK == res) && (val>0))
-        printf("Name lookup time: %0.3f sec.\n", val);
+        printf("Name lookup time: %" CURL_FORMAT_CURL_OFF_T ".%06ld sec.\n",
+               (val / 1000000), (long)(val % 1000000));
 
       /* check for connect time */
-      res = curl_easy_getinfo(curl_handle, CURLINFO_CONNECT_TIME, &val);
+      res = curl_easy_getinfo(curl_handle, CURLINFO_CONNECT_TIME_T, &val);
       if((CURLE_OK == res) && (val>0))
-        printf("Connect time: %0.3f sec.\n", val);
+        printf("Connect time: %" CURL_FORMAT_CURL_OFF_T ".%06ld sec.\n",
+               (val / 1000000), (long)(val % 1000000));
     }
   }
   else {
index 6b05c4cec72e17ab40af2b368260d27c4ba520e8..8128608c408b7840c5ea6f9bec7cce9c05af1a0f 100644 (file)
@@ -33,7 +33,7 @@ int main(void)
   CURL *curl;
   CURLcode res;
   struct stat file_info;
-  double speed_upload, total_time;
+  curl_off_t speed_upload, total_time;
   FILE *fd;
 
   fd = fopen("debugit", "rb"); /* open file to upload */
@@ -72,11 +72,13 @@ int main(void)
     }
     else {
       /* now extract transfer info */
-      curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload);
-      curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time);
+      curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD_T, &speed_upload);
+      curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total_time);
 
-      fprintf(stderr, "Speed: %.3f bytes/sec during %.3f seconds\n",
-              speed_upload, total_time);
+      fprintf(stderr, "Speed: %" CURL_FORMAT_CURL_OFF_T " bytes/sec during %"
+              CURL_FORMAT_CURL_OFF_T ".%06ld seconds\n",
+              speed_upload,
+              (total_time / 1000000), (long)(total_time % 1000000));
 
     }
     /* always cleanup */
index ab34ef988d14ad37da0e2d8a99f3ea476e2b7364..52a3c0834ac48026d78a47e924730ca61e856cfe 100644 (file)
 #include <curl/curl.h>
 
 #define STOP_DOWNLOAD_AFTER_THIS_MANY_BYTES         6000
-#define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL     3
+#define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL     3000000
 
 struct myprogress {
-  double lastruntime;
+  curl_off_t lastruntime;
   CURL *curl;
 };
 
@@ -42,16 +42,17 @@ static int xferinfo(void *p,
 {
   struct myprogress *myp = (struct myprogress *)p;
   CURL *curl = myp->curl;
-  double curtime = 0;
+  curl_off_t curtime = 0;
 
-  curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &curtime);
+  curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &curtime);
 
   /* under certain circumstances it may be desirable for certain functionality
      to only run every N seconds, in order to do this the transaction time can
      be used */
   if((curtime - myp->lastruntime) >= MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL) {
     myp->lastruntime = curtime;
-    fprintf(stderr, "TOTAL TIME: %f \r\n", curtime);
+    fprintf(stderr, "TOTAL TIME: %" CURL_FORMAT_CURL_OFF_T ".%06ld\r\n",
+            (curtime / 1000000), (long)(curtime % 1000000));
   }
 
   fprintf(stderr, "UP: %" CURL_FORMAT_CURL_OFF_T " of %" CURL_FORMAT_CURL_OFF_T
index c306937ae291e2d82f3a8a302b81da5ea679d48e..d41812f84bdb69ef7df10e141fa682e8235871cd 100644 (file)
@@ -60,24 +60,45 @@ Remote time of the retrieved document. See \fICURLINFO_FILETIME_T(3)\fP
 .IP CURLINFO_TOTAL_TIME
 Total time of previous transfer.
 See \fICURLINFO_TOTAL_TIME(3)\fP
+.IP CURLINFO_TOTAL_TIME_T
+Total time of previous transfer.
+See \fICURLINFO_TOTAL_TIME_T(3)\fP
 .IP CURLINFO_NAMELOOKUP_TIME
 Time from start until name resolving completed.
 See \fICURLINFO_NAMELOOKUP_TIME(3)\fP
+.IP CURLINFO_NAMELOOKUP_TIME_T
+Time from start until name resolving completed.
+See \fICURLINFO_NAMELOOKUP_TIME_T(3)\fP
 .IP CURLINFO_CONNECT_TIME
 Time from start until remote host or proxy completed.
 See \fICURLINFO_CONNECT_TIME(3)\fP
+.IP CURLINFO_CONNECT_TIME_T
+Time from start until remote host or proxy completed.
+See \fICURLINFO_CONNECT_TIME_T(3)\fP
 .IP CURLINFO_APPCONNECT_TIME
 Time from start until SSL/SSH handshake completed.
 See \fICURLINFO_APPCONNECT_TIME(3)\fP
+.IP CURLINFO_APPCONNECT_TIME_T
+Time from start until SSL/SSH handshake completed.
+See \fICURLINFO_APPCONNECT_TIME_T(3)\fP
 .IP CURLINFO_PRETRANSFER_TIME
 Time from start until just before the transfer begins.
 See \fICURLINFO_PRETRANSFER_TIME(3)\fP
+.IP CURLINFO_PRETRANSFER_TIME_T
+Time from start until just before the transfer begins.
+See \fICURLINFO_PRETRANSFER_TIME_T(3)\fP
 .IP CURLINFO_STARTTRANSFER_TIME
 Time from start until just when the first byte is received.
 See \fICURLINFO_STARTTRANSFER_TIME(3)\fP
+.IP CURLINFO_STARTTRANSFER_TIME_T
+Time from start until just when the first byte is received.
+See \fICURLINFO_STARTTRANSFER_TIME_T(3)\fP
 .IP CURLINFO_REDIRECT_TIME
 Time taken for all redirect steps before the final transfer.
 See \fICURLINFO_REDIRECT_TIME(3)\fP
+.IP CURLINFO_REDIRECT_TIME_T
+Time taken for all redirect steps before the final transfer.
+See \fICURLINFO_REDIRECT_TIME_T(3)\fP
 .IP CURLINFO_REDIRECT_COUNT
 Total number of redirects that were followed.
 See \fICURLINFO_REDIRECT_COUNT(3)\fP
@@ -221,25 +242,32 @@ curl_easy_perform()
     |--|--|--|--|--|--REDIRECT
 .fi
 .IP NAMELOOKUP
-\fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name
-resolving was completed.
+\fICURLINFO_NAMELOOKUP_TIME\fP and \fIfICURLINFO_NAMELOOKUP_TIME_T\fP.
+The time it took from the start until the name resolving was completed.
 .IP CONNECT
-\fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect
+\fICURLINFO_CONNECT_TIME\fP and \fICURLINFO_CONNECT_TIME_T\fP.
+The time it took from the start until the connect
 to the remote host (or proxy) was completed.
 .IP APPCONNECT
-\fICURLINFO_APPCONNECT_TIME\fP. The time it took from the start until the SSL
-connect/handshake with the remote host was completed. (Added in in 7.19.0)
+\fICURLINFO_APPCONNECT_TIME\fP and \fICURLINFO_APPCONNECT_TIME_T\fP.
+The time it took from the start until the SSL
+connect/handshake with the remote host was completed. (Added in 7.19.0)
+The latter is the integer version (measuring microseconds).  (Added in 7.60.0)
 .IP PRETRANSFER
-\fICURLINFO_PRETRANSFER_TIME\fP. The time it took from the start until the
+\fICURLINFO_PRETRANSFER_TIME\fP and \fICURLINFO_PRETRANSFER_TIME_T\fP.
+The time it took from the start until the
 file transfer is just about to begin. This includes all pre-transfer commands
 and negotiations that are specific to the particular protocol(s) involved.
 .IP STARTTRANSFER
-\fICURLINFO_STARTTRANSFER_TIME\fP. The time it took from the start until the
+\fICURLINFO_STARTTRANSFER_TIME\fP and \fICURLINFO_STARTTRANSFER_TIME_T\fP.
+The time it took from the start until the
 first byte is received by libcurl.
 .IP TOTAL
-\fICURLINFO_TOTAL_TIME\fP. Total time of the previous request.
+\fICURLINFO_TOTAL_TIME\fP and \fICURLINFO_TOTAL_TIME_T\fP.
+Total time of the previous request.
 .IP REDIRECT
-\fICURLINFO_REDIRECT_TIME\fP. The time it took for all redirection steps
+\fICURLINFO_REDIRECT_TIME\fP and \fICURLINFO_REDIRECT_TIME_T\fP.
+The time it took for all redirection steps
 include name lookup, connect, pretransfer and transfer before final
 transaction was started. So, this is zero if no redirection took place.
 .SH RETURN VALUE
index dee0981ed930be18c1142d1084d34a8dc67e5803..fb0c982a46a829369d4094331428a63baf5a8cfa 100644 (file)
@@ -59,4 +59,4 @@ Added in 7.19.0
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
-.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_APPCONNECT_TIME_T "(3)"
diff --git a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3
new file mode 100644 (file)
index 0000000..8c06d68
--- /dev/null
@@ -0,0 +1,64 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLINFO_APPCONNECT_TIME_T 3 "28 Apr 2018" "libcurl 7.61.0" "curl_easy_getinfo options"
+.SH NAME
+CURLINFO_APPCONNECT_TIME_T \- get the time until the SSL/SSH handshake is completed
+.SH SYNOPSIS
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME_T, curl_off_t *timep);
+.SH DESCRIPTION
+Pass a pointer to a curl_off_t to receive the time, in microseconds,
+it took from the
+start until the SSL/SSH connect/handshake to the remote host was completed.
+This time is most often very near to the \fICURLINFO_PRETRANSFER_TIME_T(3)\fP
+time, except for cases such as HTTP pipelining where the pretransfer time can
+be delayed due to waits in line for the pipeline and more.
+
+See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_off_t connect;
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect);
+    if(CURLE_OK == res) {
+      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
+             (long)(connect % 1000000));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.61.0
+.SH RETURN VALUE
+Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
+.SH "SEE ALSO"
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_APPCONNECT_TIME "(3)"
index f9e5d812a6737733f5aba34f999e8571f1269c85..4b6d3dee98c29ae9e8ce75c4cb93177052f998a3 100644 (file)
@@ -56,4 +56,4 @@ Added in 7.4.1
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
-.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_CONNECT_TIME_T "(3)"
diff --git a/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3 b/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3
new file mode 100644 (file)
index 0000000..aed2e9d
--- /dev/null
@@ -0,0 +1,59 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLINFO_CONNECT_TIME_T 3 "28 Apr 2018" "libcurl 7.61.0" "curl_easy_getinfo options"
+.SH NAME
+CURLINFO_CONNECT_TIME_T \- get the time until connect
+.SH SYNOPSIS
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME_T, curl_off_t *timep);
+.SH DESCRIPTION
+Pass a pointer to a curl_off_t to receive the total time in microseconds
+from the start until the connection to the remote host (or proxy) was completed.
+See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_off_t connect;
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
+    if(CURLE_OK == res) {
+      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
+             (long)(connect % 1000000));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.61.0
+.SH RETURN VALUE
+Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
+.SH "SEE ALSO"
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_CONNECT_TIME "(3)"
index 3d98ab79d2a8d12b56ae397bc54b758e6ce9fb3c..db916d4a81968b3bff93d28faacd736b0a069dba 100644 (file)
@@ -56,4 +56,4 @@ Added in 7.4.1
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
-.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_NAMELOOKUP_TIME_T "(3)"
diff --git a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3
new file mode 100644 (file)
index 0000000..0c13eb2
--- /dev/null
@@ -0,0 +1,60 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLINFO_NAMELOOKUP_TIME_T 3 "28 Apr 2018" "libcurl 7.61.0" "curl_easy_getinfo options"
+.SH NAME
+CURLINFO_NAMELOOKUP_TIME_T \- get the name lookup time in microseconds
+.SH SYNOPSIS
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T, curl_off_t *timep);
+.SH DESCRIPTION
+Pass a pointer to a curl_off_t to receive the total time in microseconds
+from the start until the name resolving was completed.
+
+See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_off_t namelookup;
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
+    if(CURLE_OK == res) {
+      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
+             (long)(namelookup % 1000000));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.61.0
+.SH RETURN VALUE
+Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
+.SH "SEE ALSO"
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_NAMELOOKUP_TIME "(3)"
index 04802f21c7adb3cf7d5367038d0f5b367af57708..fdc31d60c0722592db01919213482ca5d181dcbe 100644 (file)
@@ -59,4 +59,4 @@ Added in 7.4.1
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
-.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_PRETRANSFER_TIME_T "(3)"
diff --git a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3 b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3
new file mode 100644 (file)
index 0000000..2bdc3c2
--- /dev/null
@@ -0,0 +1,64 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLINFO_PRETRANSFER_TIME_T 3 "28 Apr 2018" "libcurl 7.61.0" "curl_easy_getinfo options"
+.SH NAME
+CURLINFO_PRETRANSFER_TIME_T \- get the time until the file transfer start
+.SH SYNOPSIS
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME_T, curl_off_t *timep);
+.SH DESCRIPTION
+Pass a pointer to a curl_off_t to receive the time, in microseconds,
+it took from the
+start until the file transfer is just about to begin. This includes all
+pre-transfer commands and negotiations that are specific to the particular
+protocol(s) involved. It does \fInot\fP involve the sending of the protocol-
+specific request that triggers a transfer.
+
+See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_off_t pretransfer;
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer);
+    if(CURLE_OK == res) {
+      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", pretransfer / 1000000,
+             (long)(pretransfer % 1000000));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.61.0
+.SH RETURN VALUE
+Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
+.SH "SEE ALSO"
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_PRETRANSFER_TIME "(3)"
index 26416c1b476509707562d5dc0eee9e0061390613..3cc58729b1c09e8b9322bd15deb10f9059c8f47a 100644 (file)
@@ -58,4 +58,4 @@ Added in 7.9.7
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
-.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_REDIRECT_TIME_T "(3)"
diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3
new file mode 100644 (file)
index 0000000..20fa031
--- /dev/null
@@ -0,0 +1,63 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLINFO_REDIRECT_TIME_T 3 "28 Apr 2018" "libcurl 7.61.0" "curl_easy_getinfo options"
+.SH NAME
+CURLINFO_REDIRECT_TIME_T \- get the time for all redirection steps
+.SH SYNOPSIS
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME_T, curl_off_t *timep);
+.SH DESCRIPTION
+Pass a pointer to a curl_off_t to receive the total time, in microseconds,
+it took for
+all redirection steps include name lookup, connect, pretransfer and transfer
+before final transaction was started. \fICURLINFO_REDIRECT_TIME_T\fP contains
+the complete execution time for multiple redirections.
+
+See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_off_t redirect;
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect);
+    if(CURLE_OK == res) {
+      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
+             (long)(redirect % 1000000));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.61.0
+.SH RETURN VALUE
+Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
+.SH "SEE ALSO"
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_REDIRECT_TIME "(3)"
index fa2e6c53b056579323232506d36123c40efee72b..e5252804d86e28647fea2dbcb98fa516e23f80a3 100644 (file)
@@ -58,4 +58,4 @@ Added in 7.9.2
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
-.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_STARTTRANSFER_TIME_T "(3)"
diff --git a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3 b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3
new file mode 100644 (file)
index 0000000..76d3546
--- /dev/null
@@ -0,0 +1,63 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLINFO_STARTTRANSFER_TIME_T 3 "28 Apr 2018" "libcurl 7.61.0" "curl_easy_getinfo options"
+.SH NAME
+CURLINFO_STARTTRANSFER_TIME_T \- get the time until the first byte is received
+.SH SYNOPSIS
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME_T, curl_off_t *timep);
+.SH DESCRIPTION
+Pass a pointer to a curl_off_t to receive the time, in microseconds,
+it took from the
+start until the first byte is received by libcurl. This includes
+\fICURLINFO_PRETRANSFER_TIME_T(3)\fP and also the time the server needs to
+calculate the result.
+
+See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_off_t start;
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T, &start);
+    if(CURLE_OK == res) {
+      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
+             (long)(start % 1000000));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.61.0
+.SH RETURN VALUE
+Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
+.SH "SEE ALSO"
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_STARTTRANSFER_TIME "(3)"
index dea83d88e012475b45e1e1e6cb245a9e9a6dbe73..e2386a94b1e7db34f613f3c39d2dfe78d1492d08 100644 (file)
@@ -57,4 +57,4 @@ Added in 7.4.1
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
-.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_TOTAL_TIME_T "(3)"
diff --git a/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 b/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3
new file mode 100644 (file)
index 0000000..313425b
--- /dev/null
@@ -0,0 +1,61 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLINFO_TOTAL_TIME_T 3 "28 Apr 2018" "libcurl 7.61.0" "curl_easy_getinfo options"
+.SH NAME
+CURLINFO_TOTAL_TIME_T \- get total time of previous transfer in microseconds
+.SH SYNOPSIS
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME_T, curl_off_t *timep);
+.SH DESCRIPTION
+Pass a pointer to a curl_off_t to receive the total time in microseconds
+for the previous transfer, including name resolving, TCP connect etc.
+The curl_off_t represents the time in microseconds.
+
+See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_off_t total;
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total);
+    if(CURLE_OK == res) {
+      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
+             (long)(total % 1000000));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.61.0
+.SH RETURN VALUE
+Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
+.SH "SEE ALSO"
+.BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), " CURLINFO_TOTAL_TIME "(3)"
index 80488bfa36e7aacc6b83374d69d468712865344a..74a76a7dd4234a0cce5676241ad6b176154e6e37 100644 (file)
@@ -3,9 +3,11 @@
 man_MANS =                                      \
   CURLINFO_ACTIVESOCKET.3                       \
   CURLINFO_APPCONNECT_TIME.3                    \
+  CURLINFO_APPCONNECT_TIME_T.3                  \
   CURLINFO_CERTINFO.3                           \
   CURLINFO_CONDITION_UNMET.3                    \
   CURLINFO_CONNECT_TIME.3                       \
+  CURLINFO_CONNECT_TIME_T.3                     \
   CURLINFO_CONTENT_LENGTH_DOWNLOAD.3            \
   CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.3          \
   CURLINFO_CONTENT_LENGTH_UPLOAD.3              \
@@ -24,9 +26,11 @@ man_MANS =                                      \
   CURLINFO_LOCAL_IP.3                           \
   CURLINFO_LOCAL_PORT.3                         \
   CURLINFO_NAMELOOKUP_TIME.3                    \
+  CURLINFO_NAMELOOKUP_TIME_T.3                  \
   CURLINFO_NUM_CONNECTS.3                       \
   CURLINFO_OS_ERRNO.3                           \
   CURLINFO_PRETRANSFER_TIME.3                   \
+  CURLINFO_PRETRANSFER_TIME_T.3                 \
   CURLINFO_PRIMARY_IP.3                         \
   CURLINFO_PRIMARY_PORT.3                       \
   CURLINFO_PRIVATE.3                            \
@@ -35,6 +39,7 @@ man_MANS =                                      \
   CURLINFO_PROXY_SSL_VERIFYRESULT.3             \
   CURLINFO_REDIRECT_COUNT.3                     \
   CURLINFO_REDIRECT_TIME.3                      \
+  CURLINFO_REDIRECT_TIME_T.3                    \
   CURLINFO_REDIRECT_URL.3                       \
   CURLINFO_REQUEST_SIZE.3                       \
   CURLINFO_RESPONSE_CODE.3                      \
@@ -54,9 +59,11 @@ man_MANS =                                      \
   CURLINFO_SSL_ENGINES.3                        \
   CURLINFO_SSL_VERIFYRESULT.3                   \
   CURLINFO_STARTTRANSFER_TIME.3                 \
+  CURLINFO_STARTTRANSFER_TIME_T.3               \
   CURLINFO_TLS_SESSION.3                        \
   CURLINFO_TLS_SSL_PTR.3                        \
   CURLINFO_TOTAL_TIME.3                         \
+  CURLINFO_TOTAL_TIME_T.3                       \
   CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3          \
   CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3        \
   CURLMOPT_MAXCONNECTS.3                        \
index 52e8407dd2514922df80df93e93cb668f3d14762..7df2d700c395bea65234d2885dcd5e9fadb189e7 100644 (file)
@@ -206,9 +206,11 @@ CURLHEADER_SEPARATE             7.37.0
 CURLHEADER_UNIFIED              7.37.0
 CURLINFO_ACTIVESOCKET           7.45.0
 CURLINFO_APPCONNECT_TIME        7.19.0
+CURLINFO_APPCONNECT_TIME_T      7.61.0
 CURLINFO_CERTINFO               7.19.1
 CURLINFO_CONDITION_UNMET        7.19.4
 CURLINFO_CONNECT_TIME           7.4.1
+CURLINFO_CONNECT_TIME_T         7.61.0
 CURLINFO_CONTENT_LENGTH_DOWNLOAD 7.6.1
 CURLINFO_CONTENT_LENGTH_DOWNLOAD_T 7.55.0
 CURLINFO_CONTENT_LENGTH_UPLOAD  7.6.1
@@ -237,11 +239,13 @@ CURLINFO_LOCAL_PORT             7.21.0
 CURLINFO_LONG                   7.4.1
 CURLINFO_MASK                   7.4.1
 CURLINFO_NAMELOOKUP_TIME        7.4.1
+CURLINFO_NAMELOOKUP_TIME_T      7.61.0
 CURLINFO_NONE                   7.4.1
 CURLINFO_NUM_CONNECTS           7.12.3
 CURLINFO_OFF_T                  7.55.0
 CURLINFO_OS_ERRNO               7.12.2
 CURLINFO_PRETRANSFER_TIME       7.4.1
+CURLINFO_PRETRANSFER_TIME_T     7.61.0
 CURLINFO_PRIMARY_IP             7.19.0
 CURLINFO_PRIMARY_PORT           7.21.0
 CURLINFO_PRIVATE                7.10.3
@@ -251,6 +255,7 @@ CURLINFO_PROXY_SSL_VERIFYRESULT 7.52.0
 CURLINFO_PTR                    7.54.1
 CURLINFO_REDIRECT_COUNT         7.9.7
 CURLINFO_REDIRECT_TIME          7.9.7
+CURLINFO_REDIRECT_TIME_T        7.61.0
 CURLINFO_REDIRECT_URL           7.18.2
 CURLINFO_REQUEST_SIZE           7.4.1
 CURLINFO_RESPONSE_CODE          7.10.8
@@ -274,11 +279,13 @@ CURLINFO_SSL_DATA_OUT           7.12.1
 CURLINFO_SSL_ENGINES            7.12.3
 CURLINFO_SSL_VERIFYRESULT       7.5
 CURLINFO_STARTTRANSFER_TIME     7.9.2
+CURLINFO_STARTTRANSFER_TIME_T   7.61.0
 CURLINFO_STRING                 7.4.1
 CURLINFO_TEXT                   7.9.6
 CURLINFO_TLS_SESSION            7.34.0        7.48.0
 CURLINFO_TLS_SSL_PTR            7.48.0
 CURLINFO_TOTAL_TIME             7.4.1
+CURLINFO_TOTAL_TIME_T           7.61.0
 CURLINFO_TYPEMASK               7.4.1
 CURLIOCMD_NOP                   7.12.3
 CURLIOCMD_RESTARTREAD           7.12.3
index 3fd4ca87d350476294f2d65d0248edd1e468f0ce..42dfc78bc12b8cbbb7892d7f8f0e5f51ca65fe0c 100644 (file)
@@ -2527,7 +2527,17 @@ typedef enum {
   CURLINFO_SCHEME           = CURLINFO_STRING + 49,
   /* Fill in new entries below here! */
 
-  CURLINFO_LASTONE          = 49
+  /* Preferably these would be defined conditionally based on the
+     sizeof curl_off_t being 64-bits */
+  CURLINFO_TOTAL_TIME_T     = CURLINFO_OFF_T + 50,
+  CURLINFO_NAMELOOKUP_TIME_T = CURLINFO_OFF_T + 51,
+  CURLINFO_CONNECT_TIME_T   = CURLINFO_OFF_T + 52,
+  CURLINFO_PRETRANSFER_TIME_T = CURLINFO_OFF_T + 53,
+  CURLINFO_STARTTRANSFER_TIME_T = CURLINFO_OFF_T + 54,
+  CURLINFO_REDIRECT_TIME_T  = CURLINFO_OFF_T + 55,
+  CURLINFO_APPCONNECT_TIME_T = CURLINFO_OFF_T + 56,
+
+  CURLINFO_LASTONE          = 56
 } CURLINFO;
 
 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
index d280eebfafaeb16737ef4c64f0bbd6914c201066..14b456274a74da7e8ef3a81837e89342c11f61aa 100644 (file)
@@ -281,6 +281,28 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
     *param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
       data->progress.size_ul:-1;
     break;
+  case CURLINFO_TOTAL_TIME_T:
+    *param_offt = data->progress.timespent;
+    break;
+  case CURLINFO_NAMELOOKUP_TIME_T:
+    *param_offt = data->progress.t_nslookup;
+    break;
+  case CURLINFO_CONNECT_TIME_T:
+    *param_offt = data->progress.t_connect;
+    break;
+  case CURLINFO_APPCONNECT_TIME_T:
+    *param_offt = data->progress.t_appconnect;
+    break;
+  case CURLINFO_PRETRANSFER_TIME_T:
+    *param_offt = data->progress.t_pretransfer;
+    break;
+  case CURLINFO_STARTTRANSFER_TIME_T:
+    *param_offt = data->progress.t_starttransfer;
+    break;
+  case CURLINFO_REDIRECT_TIME_T:
+    *param_offt = data->progress.t_redirect;
+    break;
+
   default:
     return CURLE_UNKNOWN_OPTION;
   }
index 677ab73a76f521bb870e4ac0b6c0cee20914b13d..2a6c58bb56b19944826ae4f7b6c15829a447b0df 100644 (file)
@@ -96,36 +96,50 @@ int test(char *URL)
     if(libtest_arg2) {
       FILE *moo = fopen(libtest_arg2, "wb");
       if(moo) {
-        double time_namelookup;
-        double time_connect;
-        double time_pretransfer;
-        double time_starttransfer;
-        double time_total;
+        curl_off_t time_namelookup;
+        curl_off_t time_connect;
+        curl_off_t time_pretransfer;
+        curl_off_t time_starttransfer;
+        curl_off_t time_total;
         fprintf(moo, "IP: %s\n", ipstr);
-        curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup);
-        curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect);
-        curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer);
-        curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
+        curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &time_namelookup);
+        curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &time_connect);
+        curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T,
+                          &time_pretransfer);
+        curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T,
                           &time_starttransfer);
-        curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total);
+        curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &time_total);
 
         /* since the timing will always vary we only compare relative
            differences between these 5 times */
         if(time_namelookup > time_connect) {
-          fprintf(moo, "namelookup vs connect: %f %f\n",
-                  time_namelookup, time_connect);
+          fprintf(moo, "namelookup vs connect: %" CURL_FORMAT_CURL_OFF_T
+                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                  (time_namelookup / 1000000),
+                  (long)(time_namelookup % 1000000),
+                  (time_connect / 1000000), (long)(time_connect % 1000000));
         }
         if(time_connect > time_pretransfer) {
-          fprintf(moo, "connect vs pretransfer: %f %f\n",
-                  time_connect, time_pretransfer);
+          fprintf(moo, "connect vs pretransfer: %" CURL_FORMAT_CURL_OFF_T
+                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                  (time_connect / 1000000), (long)(time_connect % 1000000),
+                  (time_pretransfer / 1000000),
+                  (long)(time_pretransfer % 1000000));
         }
         if(time_pretransfer > time_starttransfer) {
-          fprintf(moo, "pretransfer vs starttransfer: %f %f\n",
-                  time_pretransfer, time_starttransfer);
+          fprintf(moo, "pretransfer vs starttransfer: %" CURL_FORMAT_CURL_OFF_T
+                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                  (time_pretransfer / 1000000),
+                  (long)(time_pretransfer % 1000000),
+                  (time_starttransfer / 1000000),
+                  (long)(time_starttransfer % 1000000));
         }
         if(time_starttransfer > time_total) {
-          fprintf(moo, "starttransfer vs total: %f %f\n",
-                  time_starttransfer, time_total);
+          fprintf(moo, "starttransfer vs total: %" CURL_FORMAT_CURL_OFF_T
+                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                  (time_starttransfer / 1000000),
+                  (long)(time_starttransfer % 1000000),
+                  (time_total / 1000000), (long)(time_total % 1000000));
         }
 
         fclose(moo);