1 /* 2 * (C) Copyright 2002-2006 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 #include <common.h> 8 9 char *strmhz (char *buf, unsigned long hz) 10 { 11 long l, n; 12 long m; 13 14 n = DIV_ROUND(hz, 1000) / 1000L; 15 l = sprintf (buf, "%ld", n); 16 17 hz -= n * 1000000L; 18 m = DIV_ROUND(hz, 1000L); 19 if (m != 0) 20 sprintf (buf + l, ".%03ld", m); 21 return (buf); 22 } 23