]> granicus.if.org Git - check/commitdiff
Changing duration returned from DIFF_IN_USEC to unsigned long
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sat, 25 Jan 2014 18:18:05 +0000 (18:18 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sat, 25 Jan 2014 18:18:05 +0000 (18:18 +0000)
In the case that the diff returned from the start and end of the test
overflowed an unsigned int, making the container for the result
an unsigned long. (This is the type returned from the macro anyway).

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1060 64e312b2-a51f-0410-8e61-82d0ca0eb02a

src/check_log.c

index 2439ac737d32fa170a87fdc839dc6dfb045a17b9..35459c4c1964421560f19ed7f66107fc58a2ccf9 100644 (file)
@@ -274,12 +274,12 @@ void xml_lfun (SRunner *sr CK_ATTRIBUTE_UNUSED, FILE *file, enum print_output pr
   case CLENDLOG_SR:
     {
       struct timespec ts_end = {0,0};
-      unsigned int duration;
+      unsigned long duration;
 
       /* calculate time the test were running */
       clock_gettime(check_get_clockid(), &ts_end);
-      duration = DIFF_IN_USEC(ts_start, ts_end);
-      fprintf(file, "  <duration>%u.%06u</duration>\n",
+      duration = (unsigned long)DIFF_IN_USEC(ts_start, ts_end);
+      fprintf(file, "  <duration>%lu.%06lu</duration>\n",
           duration / US_PER_SEC, duration % US_PER_SEC);
       fprintf(file, "</testsuites>\n");
     }