From: brarcher Date: Sat, 25 Jan 2014 18:18:05 +0000 (+0000) Subject: Changing duration returned from DIFF_IN_USEC to unsigned long X-Git-Tag: 0.10.0~157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66a7786c29036a966ebc935b2cb69991276d90ed;p=check Changing duration returned from DIFF_IN_USEC to unsigned long 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 --- diff --git a/src/check_log.c b/src/check_log.c index 2439ac7..35459c4 100644 --- a/src/check_log.c +++ b/src/check_log.c @@ -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, " %u.%06u\n", + duration = (unsigned long)DIFF_IN_USEC(ts_start, ts_end); + fprintf(file, " %lu.%06lu\n", duration / US_PER_SEC, duration % US_PER_SEC); fprintf(file, "\n"); }