1CURLINFO_FILETIME(3) curl_easy_getinfo options CURLINFO_FILETIME(3)
2
3
4
6 CURLINFO_FILETIME - get the remote time of the retrieved document
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long
12 *timep);
13
15 Pass a pointer to a long to receive the remote time of the retrieved
16 document (in number of seconds since 1 jan 1970 in the GMT/UTC time
17 zone). If you get -1, it can be because of many reasons (it might be
18 unknown, the server might hide it or the server doesn't support the
19 command that tells document time etc) and the time of the document is
20 unknown.
21
22 You must tell libcurl to collect this information before the transfer
23 is made, by using the CURLOPT_FILETIME(3) option to curl_easy_setopt(3)
24 or you will unconditionally get a -1 back.
25
26 Consider using CURLINFO_FILETIME_T(3) to be able to extract dates
27 beyond the year 2038 on systems using 32 bit longs.
28
30 HTTP(S), FTP(S), SFTP
31
33 curl = curl_easy_init();
34 if(curl) {
35 curl_easy_setopt(curl, CURLOPT_URL, url);
36 /* Ask for filetime */
37 curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
38 res = curl_easy_perform(curl);
39 if(CURLE_OK == res) {
40 res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
41 if((CURLE_OK == res) && (filetime >= 0)) {
42 time_t file_time = (time_t)filetime;
43 printf("filetime %s: %s", filename, ctime(&file_time));
44 }
45 }
46 /* always cleanup */
47 curl_easy_cleanup(curl);
48 }
49
51 Added in 7.5
52
54 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
55 if not.
56
58 curl_easy_getinfo(3), curl_easy_setopt(3),
59
60
61
62libcurl 7.61.1 January 25, 2018 CURLINFO_FILETIME(3)