Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_TIMECONDITION.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 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 "April 03, 2016" "libcurl 7.59.0" "curl_easy_setopt options"
24
25 .SH NAME
26 CURLOPT_TIMECONDITION \- select condition for a time request
27 .SH SYNOPSIS
28 #include <curl/curl.h>
29
30 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond);
31 .SH DESCRIPTION
32 Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE(3)\fP time
33 value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP
34 or \fICURL_TIMECOND_IFUNMODSINCE\fP.
35
36 The last modification time of a file is not always known and in such instances
37 this feature will have no effect even if the given time condition would not
38 have been met. \fIcurl_easy_getinfo(3)\fP with the
39 \fICURLINFO_CONDITION_UNMET\fP option can be used after a transfer to learn if
40 a zero-byte successful "transfer" was due to this condition not matching.
41 .SH DEFAULT
42 CURL_TIMECOND_NONE (0)
43 .SH PROTOCOLS
44 HTTP, FTP, RTSP, and FILE
45 .SH EXAMPLE
46 .nf
47 CURL *curl = curl_easy_init();
48 if(curl) {
49   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
50
51   /* January 1, 2020 is 1577833200 */
52   curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
53
54   /* If-Modified-Since the above time stamp */
55   curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
56
57   /* Perform the request */
58   curl_easy_perform(curl);
59 }
60 .fi
61 .SH AVAILABILITY
62 Always
63 .SH RETURN VALUE
64 Returns CURLE_OK
65 .SH "SEE ALSO"
66 .BR CURLOPT_TIMEVALUE "(3), "