]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Fix time diff warning log message.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 13 Jun 2022 18:31:23 +0000 (20:31 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 28 Jul 2022 14:38:56 +0000 (16:38 +0200)
The format string contains %lu to print a long unsigned, but we
possibly multiply the value with -1, which can lead to output like

Jun 13 13:36:37 baader (3) compute_time_diff: time diff jump: 4294808018ms

Fix this by replacing the multiplication with an additional format
string directive to print the leading +/- explicitly. This is easy
since we already have the sign in a variable, and it avoids any
integer conversion/overflow issues.

audiod.c

index 113f1132e96c92f5045c4acdc72211728230137b..c565d44129c4a5d2bedc50b1a49430cb29805d73 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -749,8 +749,8 @@ static void compute_time_diff(const struct timeval *status_time)
        if (count > 5) {
                int s = tv_diff(&diff, &stat_task->sa_time_diff, &tmp);
                if (tv_diff(&max_deviation, &tmp, NULL) < 0)
-                       PARA_WARNING_LOG("time diff jump: %lums\n",
-                               s * tv2ms(&tmp));
+                       PARA_WARNING_LOG("time diff jump: %c%lums\n",
+                               s < 0? '-' : '+', tv2ms(&tmp));
        }
        count++;
        sa_time_diff_sign = tv_convex_combination(