]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CURLMOPT_TIMERFUNCTION.md: correct the example
authorDaniel Stenberg <daniel@haxx.se>
Fri, 9 May 2025 13:41:48 +0000 (15:41 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 9 May 2025 15:04:40 +0000 (17:04 +0200)
Fixes #17301
Reported-by: Dirk Feytons
Closes #17303

docs/libcurl/opts/CURLMOPT_TIMERDATA.md
docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.md

index 69cd4e215d7c26aa741b985c43598745247f3773..7226bcb481e362a6096e9d18b938b0a4f0105b8f 100644 (file)
@@ -50,7 +50,7 @@ static int timerfunc(CURLM *multi, long timeout_ms, void *clientp)
   struct priv *mydata = clientp;
   printf("our ptr: %p\n", mydata->custom);
 
-  if(timeout_ms) {
+  if(timeout_ms >= 0) {
     /* this is the new single timeout to wait for */
   }
   else {
index a4ecf622d7bed351517ecc955ecc496846ce1a1f..ac55fb351bf9efe74b304d2f3d82be73fd687a81 100644 (file)
@@ -46,7 +46,8 @@ time *replaces* the former timeout. The application should then effectively
 cancel the old timeout and set a new timeout using this new expire time.
 
 A **timeout_ms** value of -1 passed to this callback means you should delete
-the timer. All other values are valid expire times in number of milliseconds.
+the timer. All other values are valid expire times in number of milliseconds -
+including zero milliseconds.
 
 The **timer_callback** is called when the timeout expire time is changed.
 
@@ -82,8 +83,8 @@ static int timerfunc(CURLM *multi, long timeout_ms, void *clientp)
   struct priv *mydata = clientp;
   printf("our ptr: %p\n", mydata->custom);
 
-  if(timeout_ms) {
-    /* this is the new single timeout to wait for */
+  if(timeout_ms >= 0) {
+    /* this is the new single timeout to wait for, including zero */
   }
   else {
     /* delete the timeout, nothing to wait for now */