]> granicus.if.org Git - strace/commitdiff
time: add xlat styles support to printclockname
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 31 Aug 2018 04:42:28 +0000 (06:42 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 4 Sep 2018 11:13:52 +0000 (11:13 +0000)
* time.c (printclockname): Respectl xlat_verbosity.

time.c

diff --git a/time.c b/time.c
index 1f44dca714e0693f25509a59635b73fee7b31ca3..734a79b8d3fe10cde95a70ffd0a2e3136f11d80c 100644 (file)
--- a/time.c
+++ b/time.c
@@ -198,6 +198,15 @@ printclockname(int clockid)
 # include "xlat/cpuclocknames.h"
 
        if (clockid < 0) {
+               if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
+                       tprintf("%d", clockid);
+
+               if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
+                       return;
+
+               if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
+                       tprints(" /* ");
+
                if ((clockid & CLOCKFD_MASK) == CLOCKFD)
                        tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid));
                else {
@@ -211,6 +220,9 @@ printclockname(int clockid)
                                        "CPUCLOCK_???");
                        tprints(")");
                }
+
+               if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
+                       tprints(" */");
        } else
 #endif
                printxval_index(clocknames, clockid, "CLOCK_???");