PulseView
0.3.0
A Qt-based sigrok GUI
|
Typedefs | |
typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float< 24 >, boost::multiprecision::et_off > | Timestamp |
Timestamp type providing yoctosecond resolution. More... | |
Enumerations | |
enum | TimeUnit { TimeUnit::Time = 1, TimeUnit::Samples = 2 } |
enum | SIPrefix { SIPrefix::unspecified = -1, SIPrefix::yocto, SIPrefix::zepto, SIPrefix::atto, SIPrefix::femto, SIPrefix::pico, SIPrefix::nano, SIPrefix::micro, SIPrefix::milli, SIPrefix::none, SIPrefix::kilo, SIPrefix::mega, SIPrefix::giga, SIPrefix::tera, SIPrefix::peta, SIPrefix::exa, SIPrefix::zetta, SIPrefix::yotta } |
Functions | |
static QTextStream & | operator<< (QTextStream &stream, SIPrefix prefix) |
int | exponent (SIPrefix prefix) |
Returns the exponent that corresponds to a given prefix. More... | |
static SIPrefix | successor (SIPrefix prefix) |
static QTextStream & | operator<< (QTextStream &stream, const Timestamp &t) |
QString | format_time_si (const Timestamp &v, SIPrefix prefix, unsigned int precision, QString unit, bool sign) |
QString | format_time_si_adjusted (const Timestamp &t, SIPrefix prefix, unsigned precision, QString unit, bool sign) |
static QString | pad_number (unsigned int number, int length) |
QString | format_time_minutes (const Timestamp &t, signed precision, bool sign) |
QString | format_time_si (const Timestamp &t, SIPrefix prefix=SIPrefix::unspecified, unsigned precision=0, QString unit="s", bool sign=true) |
typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float<24>, boost::multiprecision::et_off> pv::util::Timestamp |
|
strong |
|
strong |
int pv::util::exponent | ( | SIPrefix | prefix | ) |
QString pv::util::format_time_minutes | ( | const Timestamp & | t, |
signed | precision = 0 , |
||
bool | sign = true |
||
) |
Formats the given timestamp using "[+-]DD:HH:MM:SS.mmm uuu nnn ppp..." format.
"DD" and "HH" are left out if they would be "00" (but if "DD" is generated, "HH" is also always generated. The "MM:SS" part is always produced, the number of subsecond digits can be influenced using the 'precision' parameter.
t | The value to format. |
precision | The number of digits after the decimal separator. |
sign | Whether or not to add a sign also for positive numbers. |
Definition at line 174 of file util.cpp.
QString pv::util::format_time_si | ( | const Timestamp & | t, |
SIPrefix | prefix = SIPrefix::unspecified , |
||
unsigned | precision = 0 , |
||
QString | unit = "s" , |
||
bool | sign = true |
||
) |
Formats a given timestamp with the specified SI prefix.
If 'prefix' is left 'unspecified', the function chooses a prefix so that the value in front of the decimal point is between 1 and 999.
The default value "s" for the unit argument makes the most sense when formatting time values, but a different value can be given if the function is reused to format a value of another quantity.
t | The value to format. |
prefix | The SI prefix to use. |
precision | The number of digits after the decimal separator. |
unit | The unit of quantity. |
sign | Whether or not to add a sign also for positive numbers. |
QString pv::util::format_time_si_adjusted | ( | const Timestamp & | t, |
SIPrefix | prefix, | ||
unsigned | precision = 0 , |
||
QString | unit = "s" , |
||
bool | sign = true |
||
) |
Wrapper around 'format_time_si()' that interprets the given 'precision' value as the number of decimal places if the timestamp would be formatted without a SI prefix (using 'SIPrefix::none') and adjusts the precision to match the given 'prefix'
t | The value to format. |
prefix | The SI prefix to use. |
precision | The number of digits after the decimal separator if the 'prefix' would be 'SIPrefix::none', see above for more information. |
unit | The unit of quantity. |
sign | Whether or not to add a sign also for positive numbers. |
Definition at line 149 of file util.cpp.
|
static |
|
static |
|
static |