1CURLOPT_TIMECONDITION(3) libcurl 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,
41 (long)CURL_TIMECOND_IFMODSINCE);
42
43 /* Perform the request */
44 curl_easy_perform(curl);
45 }
46
48 Always
49
51 Returns CURLE_OK
52
54 CURLOPT_TIMEVALUE(3),
55
56
57
58ibcurl 8.2.1 April 26, 2023 CURLOPT_TIMECONDITION(3)