CURLOPT_TIMECONDITION(3)
CURLOPT_TIMECONDITION π
okay bestie, this page is CURLOPT_TIMECONDITION(3) from the Library Functions Manual β and it's literally about choosing the condition for a time request. let's go β¨
π NAME π
CURLOPT_TIMECONDITION β select condition for a time request
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond);
π¦ DESCRIPTION π¦
So you pass a long as the parameter, mkay? This defines how the CURLOPT_TIMEVALUE(3) time value is treated. You can set this parameter to CURL_TIMECOND_IFMODSINCE or CURL_TIMECOND_IFUNMODSINCE. periodt π
Quick reality check, bestie: the last modification time of a file is not always known π and in such instances this feature has no effect even if the given time condition would not have been met. To learn if a zero-byte successful "transfer" was due to this condition not matching, you can use curl_easy_getinfo(3) with the CURLINFO_CONDITION_UNMET option after a transfer. no cap, that's the whole vibe check π«Ά
π DEFAULT π
CURL_TIMECOND_NONE (0) β that's the default, bestie β¨
π PROTOCOLS π
This functionality affects file, ftp and http π¦
π₯ EXAMPLE π₯
Here's the example in all its glory β copied exactly because we do not mess with code:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* January 1, 2020 is 1577833200 */
curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
/* If-Modified-Since the above time stamp */
curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
/* Perform the request */
curl_easy_perform(curl);
}
}
π HISTORY π
CURL_TIMECOND_* enums became long types in 8.13.0; prior to this version a long cast was necessary when passed to curl_easy_setopt(3). history lesson served, iykyk π
β¨ AVAILABILITY β¨
Added in curl 7.1 πΈ
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK; non-zero means an error occurred, see libcurl-errors(3). fr fr, check the error code π«Ά
π SEE ALSO π
CURLINFO_FILETIME(3), CURLOPT_TIMEVALUE(3) β go read these next, bestie π
source/version: libcurl, date: 2026-10-12, page: CURLOPT_TIMECONDITION(3) β bye bestie, go set some time conditions π
π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms