CURLOPT_TIMEVALUE_LARGE(3)

πŸ’… CURLOPT_TIMEVALUE_LARGE πŸ’…

okay bestie, so this is the CURLOPT_TIMEVALUE_LARGE(3) page from the libcurl manual β€” yes, the library functions manual, we're fancy today. sit down, grab a lil snack πŸ“, and let me tell you about the one option that saves you from the year-2038 situation. periodt.


✨ NAME ✨

CURLOPT_TIMEVALUE_LARGE β€” the time value for your conditional request, but make it big πŸ’–


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE_LARGE,
                          curl_off_t val);

πŸ¦‹ DESCRIPTION πŸ¦‹

so you pass a curl_off_t val as the parameter, okurrr? and that value is the time counted as seconds since 1 Jan 1970 β€” yes, epoch time, the classic. and then that time gets used in a condition, exactly as specified with CURLOPT_TIMECONDITION(3) πŸ’«

now here's the tea β˜•: the difference between this option and CURLOPT_TIMEVALUE(3) is literally just the type of the argument. on systems where long is only 32 bits wide, you have to use this option to set dates beyond the year 2038. no cap. if you don't, that date is giving overflow πŸ’€


πŸŽ€ DEFAULT πŸŽ€

0

(yeah, just zero, nothing spicy 🌈)


πŸ‘‘ PROTOCOLS πŸ‘‘

this functionality affects http only. that's it. that's the whole list 🫢


πŸ”₯ EXAMPLE πŸ”₯

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_LARGE, (curl_off_t)1577833200);

    /* If-Modified-Since the above time stamp */
    curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);

    /* Perform the request */
    curl_easy_perform(curl);
  }
}

look at that. iconic. the comments are right there, I'm not touching them 😌


πŸ’œ 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). so yeah, glow-up arc, we love to see it ✨


🌈 AVAILABILITY 🌈

added in curl 7.59.0 β€” vintage but not vintage vintage, yk? 🧚


πŸ’– RETURN VALUE πŸ’–

curl_easy_setopt(3) returns a CURLcode indicating success or error.

  • CURLE_OK (0) means everything was OK β€” slay πŸ’…
  • non-zero means an error occurred 😭 β€” see libcurl-errors(3) for the whole breakdown

⭐ SEE ALSO ⭐


lowkey reminder: this is the large one for a reason. if you're on a 32-bit long system and you want a date past 2038, use this or the vibe check fails 🫢

okay that's the whole page, you're officially educated πŸ’– mwah! this lil masterpiece is brought to you by libcurl, dated 2026-10-12, and yes the manual page itself is literally named CURLOPT_TIMEVALUE_LARGE(3) β€” iykyk πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from