]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
unit1323: sync time types and printf masks, drop casts
authorViktor Szakats <commit@vsz.me>
Sun, 5 Oct 2025 22:10:13 +0000 (00:10 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 6 Oct 2025 01:27:57 +0000 (03:27 +0200)
Closes #18860

tests/unit/unit1323.c

index 41d4fd31d30789a5ab3a5f964403be36da6728d5..a4e3eab2e1037ad8754c3f6cd34f9fd75df37dd5 100644 (file)
@@ -30,14 +30,14 @@ static CURLcode test_unit1323(const char *arg)
   struct a {
     struct curltime first;
     struct curltime second;
-    time_t result;
+    timediff_t result;
   };
 
   struct a tests[] = {
-    { {36762, 8345 }, {36761, 995926 }, 13 },
-    { {36761, 995926 }, {36762, 8345 }, -13 },
-    { {36761, 995926 }, {0, 0}, 36761995 },
-    { {0, 0}, {36761, 995926 }, -36761995 },
+    { {36762, 8345}, {36761, 995926}, 13 },
+    { {36761, 995926}, {36762, 8345}, -13 },
+    { {36761, 995926}, {0, 0}, 36761995 },
+    { {0, 0}, {36761, 995926}, -36761995 },
   };
 
   size_t i;
@@ -45,13 +45,14 @@ static CURLcode test_unit1323(const char *arg)
   for(i = 0; i < CURL_ARRAYSIZE(tests); i++) {
     timediff_t result = curlx_timediff(tests[i].first, tests[i].second);
     if(result != tests[i].result) {
-      curl_mprintf("%ld.%06u to %ld.%06u got %d, but expected %ld\n",
+      curl_mprintf("%ld.%06u to %ld.%06u got %" FMT_TIMEDIFF_T
+                   ", but expected %" FMT_TIMEDIFF_T "\n",
                    (long)tests[i].first.tv_sec,
                    tests[i].first.tv_usec,
                    (long)tests[i].second.tv_sec,
                    tests[i].second.tv_usec,
-                   (int)result,
-                   (long)tests[i].result);
+                   result,
+                   tests[i].result);
       fail("unexpected result!");
     }
   }