[sysprof] format: improve string formatting for smaller timings



commit 93a21a25ab2c71daf00513abae17400dac555b15
Author: Christian Hergert <chergert redhat com>
Date:   Wed Sep 30 12:29:07 2020 -0700

    format: improve string formatting for smaller timings

 src/libsysprof-ui/sysprof-zoom-manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-zoom-manager.c b/src/libsysprof-ui/sysprof-zoom-manager.c
index b636b32..679205e 100644
--- a/src/libsysprof-ui/sysprof-zoom-manager.c
+++ b/src/libsysprof-ui/sysprof-zoom-manager.c
@@ -634,9 +634,9 @@ _sysprof_format_duration (gint64 duration)
   duration = ABS (duration);
 
   if (duration < SYSPROF_NSEC_PER_SEC)
-    return g_strdup_printf ("%s%.2lf msec",
+    return g_strdup_printf ("%s%.3lf msec",
                             negative ? "-" : "",
-                            (duration / 1000000.0));
+                            (duration / (gdouble)SYSPROF_NSEC_PER_SEC * 1000L));
   else
     return g_strdup_printf ("%s%.4lf seconds",
                             negative ? "-" : "",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]