projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce time units
[pulseview.git]
/
pv
/
util.cpp
diff --git
a/pv/util.cpp
b/pv/util.cpp
index 2e54adeaed3dffae88cb2b7354ce9eb57395302b..e3619829d1eab230cd0bda0b1b160fe5e7e404e5 100644
(file)
--- a/
pv/util.cpp
+++ b/
pv/util.cpp
@@
-52,7
+52,7
@@
QString format_si_value(double v, QString unit, int prefix,
}
assert(prefix >= 0);
}
assert(prefix >= 0);
- assert(prefix < countof(SIPrefixes));
+ assert(prefix <
(int)
countof(SIPrefixes));
const double multiplier = pow(10.0,
(int)- prefix * 3 - FirstSIPrefixPower);
const double multiplier = pow(10.0,
(int)- prefix * 3 - FirstSIPrefixPower);
@@
-67,10
+67,13
@@
QString format_si_value(double v, QString unit, int prefix,
return s;
}
return s;
}
-QString format_time(double t, int prefix,
+QString format_time(double t, int prefix,
TimeUnit unit,
unsigned int precision, bool sign)
{
unsigned int precision, bool sign)
{
- return format_si_value(t, "s", prefix, precision, sign);
+ if (unit == TimeUnit::Time)
+ return format_si_value(t, "s", prefix, precision, sign);
+ else
+ return format_si_value(t, "sa", prefix, precision, sign);
}
QString format_second(double second)
}
QString format_second(double second)