diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-07-15 10:32:27 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-07-15 10:36:47 +0200 |
commit | 24a206f6429f6fa29b9aa1ce39b7e4694e39b046 (patch) | |
tree | a96a01278274115c064049b407ba681c697651f2 /lib | |
parent | 767681c11ec6fecf9d35ba699db31ea2bdcd0702 (diff) | |
download | libquotient-24a206f6429f6fa29b9aa1ce39b7e4694e39b046.tar.gz libquotient-24a206f6429f6fa29b9aa1ce39b7e4694e39b046.zip |
operator<<(QDebug, QElapsedTimer): always use ms
That switch between micro- and milliseconds was pure visual sugaring,
in a potentially time-sensitive context.
Also: there's no sense in using const-ref for a small parameter in
a function that is, to top it off, almost always inlined.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/logging.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/logging.h b/lib/logging.h index c8d17210..2599efbf 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -72,12 +72,9 @@ inline QDebug operator<<(QDebug debug_object, Quotient::QDebugManip qdm) return qdm(debug_object); } -inline QDebug operator<<(QDebug debug_object, const QElapsedTimer& et) +inline QDebug operator<<(QDebug debug_object, QElapsedTimer et) { - auto val = et.nsecsElapsed() / 1000; - if (val < 1000) - debug_object << val << "µs"; - else - debug_object << val / 1000 << "ms"; + // Keep 3 decimal digits (the first division is int, the second is float) + debug_object << et.nsecsElapsed() / 1000 / 1000.0 << "ms"; return debug_object; } |