X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Futil.hpp;h=d59ad10eb804831f08c1b817bc4dd2deacdfc7ed;hp=5466322b738aec51d60904be5df765de45a389d2;hb=dae21ebcf60d6a5d7c194736b1dc792a5cbf06a5;hpb=d9e717371c60f8c5ace007619da1b041f4db4e25 diff --git a/pv/util.hpp b/pv/util.hpp index 5466322b..d59ad10e 100644 --- a/pv/util.hpp +++ b/pv/util.hpp @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PULSEVIEW_UTIL_H -#define PULSEVIEW_UTIL_H +#ifndef PULSEVIEW_UTIL_HPP +#define PULSEVIEW_UTIL_HPP #include @@ -28,6 +28,11 @@ namespace pv { namespace util { +enum TimeUnit { + Time = 1, + Samples = 2 +}; + extern const int FirstSIPrefixPower; /** @@ -51,13 +56,12 @@ QString format_si_value( * @param prefix The number of the prefix, from 0 for 'femto' up to * 8 for 'giga'. If prefix is set to -1, the prefix will be calculated. * @param unit The unit of quantity. - * @param precision The number of digits after the decimal separator. - * @param sign Whether or not to add a sign also for positive numbers. + * @param precision The number of digits after the decimal separator or period (.). * * @return The formated value. */ QString format_time( - double t, int prefix = -1, unsigned precision = 0, bool sign = true); + double t, int prefix = -1, TimeUnit unit = Time, unsigned precision = 0); /** * Formats a given time value with a SI prefix so that the @@ -71,4 +75,4 @@ QString format_second(double second); } // namespace util } // namespace pv -#endif // PULSEVIEW_UTIL_H +#endif // PULSEVIEW_UTIL_HPP