Skip to contentSkip to conversation

Fix strmhz(): avoid printing negative fractions

PATCH New Wolfgang Denk 1 participant 1 message Oct 21, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix strmhz(): avoid printing negative fractions

---
 lib_generic/strmhz.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib_generic/strmhz.c +1 -1
index 342cf2b..d6da1d1 100644
@@ -27,7 +27,7 @@ char *strmhz (char *buf, long hz)
 	long l, n;
 	long m;
 
-	n = DIV_ROUND(hz, 1000000L);
+	n = DIV_ROUND(hz, 1000) / 1000L;
 	l = sprintf (buf, "%ld", n);
 
 	hz -= n * 1000000L;
Signature · 14 lines
1.5.5.1


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Good manners are the settled  medium  of  social,  as  specie  is  of
commercial, life; returns are equally expected for both.
           - Lord Chesterfield _Letters to his Son_, 25 December 1753