Imported Upstream version 7.48.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_TIMECONDITION.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2014, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .\"
23 .TH CURLOPT_TIMECONDITION 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
24 .SH NAME
25 CURLOPT_TIMECONDITION \- select condition for a time request
26 .SH SYNOPSIS
27 #include <curl/curl.h>
28
29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond);
30 .SH DESCRIPTION
31 Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE(3)\fP time
32 value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP
33 or \fICURL_TIMECOND_IFUNMODSINCE\fP.
34
35 The last modification time of a file is not always known and in such instances
36 this feature will have no effect even if the given time condition would not
37 have been met. \fIcurl_easy_getinfo(3)\fP with the
38 \fICURLINFO_CONDITION_UNMET\fP option can be used after a transfer to learn if
39 a zero-byte successful "transfer" was due to this condition not matching.
40 .SH DEFAULT
41 CURL_TIMECOND_NONE (0)
42 .SH PROTOCOLS
43 HTTP, FTP, RTSP, and FILE
44 .SH EXAMPLE
45 .nf
46 CURL *curl = curl_easy_init();
47 if(curl) {
48   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
49
50   /* January 1, 2020 is 1577833200 */
51   curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
52
53   /* If-Modified-Since the above time stamp */
54   curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
55
56   /* Perform the request */
57   curl_easy_perform(curl);
58 }
59 .fi
60 .SH AVAILABILITY
61 Always
62 .SH RETURN VALUE
63 Returns CURLE_OK
64 .SH "SEE ALSO"
65 .BR CURLOPT_TIMEVALUE "(3), "