test/latency: fix timediff calculation
authorJaroslav Kysela <perex@perex.cz>
Wed, 4 Aug 2010 17:47:01 +0000 (19:47 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 4 Aug 2010 17:48:00 +0000 (19:48 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>

test/latency.c

index 304e012..03d65a2 100644 (file)
@@ -321,7 +321,7 @@ long timediff(snd_timestamp_t t1, snd_timestamp_t t2)
        l = (signed long) t1.tv_usec - (signed long) t2.tv_usec;
        if (l < 0) {
                t1.tv_sec--;
-               l = -l;
+               l = 1000000 + l;
                l %= 1000000;
        }
        return (t1.tv_sec * 1000000) + l;