1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_TIMEVALUE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_TIMECONDITION (3)
9  - CURLOPT_TIMEVALUE_LARGE (3)
10---
11
12# NAME
13
14CURLOPT_TIMEVALUE - time value for conditional
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val);
22~~~
23
24# DESCRIPTION
25
26Pass a long *val* as parameter. This should be the time counted as seconds
27since 1 Jan 1970, and the time is used in a condition as specified with
28CURLOPT_TIMECONDITION(3).
29
30On systems with 32 bit 'long' variables (such as Windows), this option cannot
31set dates beyond the year 2038. Consider CURLOPT_TIMEVALUE_LARGE(3)
32instead.
33
34# DEFAULT
35
360
37
38# PROTOCOLS
39
40HTTP, FTP, RTSP, and FILE
41
42# EXAMPLE
43
44~~~c
45int main(void)
46{
47  CURL *curl = curl_easy_init();
48  if(curl) {
49    curl_easy_setopt(curl, CURLOPT_URL, "https://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}
61~~~
62
63# AVAILABILITY
64
65Always
66
67# RETURN VALUE
68
69Returns CURLE_OK
70