1CURLOPT_TIMECONDITION(3) curl_easy_setopt options CURLOPT_TIMECONDITION(3)
2
3
4
6 CURLOPT_TIMECONDITION - select condition for a time request
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond);
12
14 Pass a long as parameter. This defines how the CURLOPT_TIMEVALUE(3)
15 time value is treated. You can set this parameter to CURL_TIMECOND_IF‐
16 MODSINCE or CURL_TIMECOND_IFUNMODSINCE.
17
18 The last modification time of a file is not always known and in such
19 instances this feature will have no effect even if the given time con‐
20 dition would not have been met. curl_easy_getinfo(3) with the
21 CURLINFO_CONDITION_UNMET option can be used after a transfer to learn
22 if a zero-byte successful "transfer" was due to this condition not
23 matching.
24
26 CURL_TIMECOND_NONE (0)
27
29 HTTP, FTP, RTSP, and FILE
30
32 CURL *curl = curl_easy_init();
33 if(curl) {
34 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
35
36 /* January 1, 2020 is 1577833200 */
37 curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
38
39 /* If-Modified-Since the above time stamp */
40 curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
41
42 /* Perform the request */
43 curl_easy_perform(curl);
44 }
45
47 Always
48
50 Returns CURLE_OK
51
53 CURLOPT_TIMEVALUE(3),
54
55
56
57libcurl 7.82.0 November 26, 2021 CURLOPT_TIMECONDITION(3)