X-Git-Url: http://git.meshlink.io/?p=utcp;a=blobdiff_plain;f=utcp.c;h=10d026efabf2679db6ca419c71131e5fecd7e582;hp=383e27f341b8e2c85a61da86013ac30184a24542;hb=9470c449236afef22210803b359fe44d74e32636;hpb=a7d31e61566f0d2e6cb0821fcdaf74ccfc1f8f64 diff --git a/utcp.c b/utcp.c index 383e27f..10d026e 100644 --- a/utcp.c +++ b/utcp.c @@ -61,8 +61,7 @@ static void timespec_sub(const struct timespec *a, const struct timespec *b, str } static int32_t timespec_diff_usec(const struct timespec *a, const struct timespec *b) { - int64_t diff = (a->tv_sec - b->tv_sec) * 1000000000 + a->tv_sec - b->tv_sec; - return diff / 1000; + return (a->tv_sec - b->tv_sec) * 1000000 + (a->tv_nsec - b->tv_nsec) / 1000; } static bool timespec_lt(const struct timespec *a, const struct timespec *b) {