Index: mapiproxy/modules/mpm_cache.c =================================================================== --- mapiproxy/modules/mpm_cache.c (revision 943) +++ mapiproxy/modules/mpm_cache.c (working copy) @@ -75,8 +75,6 @@ { TALLOC_CTX *mem_ctx; struct timeval tv_end; - uint64_t sec; - uint64_t usec; char *name; const char *stage; @@ -96,17 +94,7 @@ } gettimeofday(&tv_end, NULL); - sec = tv_end.tv_sec - stream->tv_start.tv_sec; - if ((tv_end.tv_usec - stream->tv_start.tv_usec) < 0) { - sec -= 1; - usec = tv_end.tv_usec + stream->tv_start.tv_usec; - while (usec > 1000000) { - usec -= 1000000; - sec += 1; - } - } else { - usec = tv_end.tv_usec - stream->tv_start.tv_usec; - } + timersub(&tv_end, &stream->tv_start, &tv_end); if (stream->ahead == true) { stage = "[read ahead]"; @@ -117,7 +105,7 @@ } DEBUG(1, ("STATISTIC: %-20s %s The difference is %ld seconds %ld microseconds\n", - stage, name, (long int)sec, (long int)usec)); + stage, name, (long int)tv_end.tv_sec, (long int)tv_end.tv_usec)); talloc_free(name); }