Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLINFO_FILETIME.3
index 84093eb..0b77214 100644 (file)
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 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
@@ -20,7 +20,8 @@
 .\" *
 .\" **************************************************************************
 .\"
-.TH CURLINFO_FILETIME 3 "28 Aug 2015" "libcurl 7.44.0" "curl_easy_getinfo options"
+.TH CURLINFO_FILETIME 3 "January 25, 2018" "libcurl 7.59.0" "curl_easy_getinfo options"
+
 .SH NAME
 CURLINFO_FILETIME \- get the remote time of the retrieved document
 .SH SYNOPSIS
@@ -34,13 +35,33 @@ Pass a pointer to a long to receive the remote time of the retrieved document
 hide it or the server doesn't support the command that tells document time
 etc) and the time of the document is unknown.
 
-Note that you must tell the server to collect this information before the
-transfer is made, by using the \fICURLOPT_FILETIME(3)\fP option to
-\fIcurl_easy_setopt(3)\fP or you will unconditionally get a -1 back.
+You must tell libcurl to collect this information before the transfer is made,
+by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or
+you will unconditionally get a -1 back.
+
+Consider using \fICURLINFO_FILETIME_T(3)\fP to be able to extract dates beyond
+the year 2038 on systems using 32 bit longs.
 .SH PROTOCOLS
 HTTP(S), FTP(S), SFTP
 .SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, url);
+  /* Ask for filetime */
+  curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
+  res = curl_easy_perform(curl);
+  if(CURLE_OK == res) {
+    res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
+    if((CURLE_OK == res) && (filetime >= 0)) {
+      time_t file_time = (time_t)filetime;
+      printf("filetime %s: %s", filename, ctime(&file_time));
+    }
+  }
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.5
 .SH RETURN VALUE