aboutsummaryrefslogtreecommitdiff
path: root/src/units.c
AgeCommit message (Collapse)Author
2017-10-04Fix a problem formatting very large numbers. (#642)Bruce A. Mah
Avoid walking off the end of an array when trying to format a number larger than 1000T. Motivated by #641, as reported by @shingchuang, but slightly reimplemented.
2017-05-02Fix possible integer overflow in tera prefix conversions.Bruce A. Mah
Follow-on commit for #402, possible fix for #561.
2017-04-14Add support for tera- prefix [Tt] in input and output.Bruce A. Mah
Also add some more unit tests for this and prune unused code from unit test program. Fixes #402.
2017-03-22Fix header includes and build failures on musl (#518)f1rebird
* Include stdint.h in files where its types are used Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com> * Fix type of len parameter passed to getsockopt getsockopt expects socklen_t instead of int as its fifth argument Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com> * Remove unnecassary includes of netinet/tcp.h also cleanup the second include of stdint.h in main.c This commit fixes #331 and is a replacement for #344. Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>
2015-02-12Fix a toupper() usage too to avoid negative signed chars.Havard Eidnes
2014-08-25When parsing the -b (bandwidth) argument, use 10-based suffices.Bruce A. Mah
We support using k, m, and g as suffices on input values. In most cases these are 2-based suffixes (i.e. K == 1024) because they are sizes of objects. In the case of rates, we need to use 10-based suffices (i.e. K == 1000). We do this by implementing (using copy-and-paste) a unit_atof_rate() subroutine that parses strings similarly to unit_atof but using 10-based suffices instead. Fixes #173.
2014-05-19Check HAVE_STDINT_H before trying to include <stdint.h>.Bruce A. Mah
Partial fix for compilation on some Solaris versions. Fixes #175. Submitted by: @marksolaris
2013-01-28The units handling was interpreting capital K/M/G as 1024/1048576/1073741824Jef Poskanzer
and lowercase k/m/g as 1000/1000000/1000000000. This was deemed to be too confusing. Now both capital and lowercase give the powers-of-two version.
2009-11-03more bug fixes, still needs workBrian Tierney
2009-11-02lots of code restructuringBrian Tierney
2009-10-19code cleanup: used 'indent' to enforce consistant styleBrian Tierney
2009-02-24fix UNIT_LENJon Dugan
tweak format in unit_snprintf
2009-02-24add unit conversion and formatting from old code. remove hungarian ↵Jon Dugan
gobbledeygook
2009-02-24bring over old unit converting functionsJon Dugan