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