]> git.alsa-project.org Git - alsa-lib.git/commitdiff
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 304e0126cc39dbfbeafd5e83a8f06e1595ef33b8..03d65a23889f3eae7c6c7aeb51050ee5ace0de9c 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;