]> git.ipfire.org Git - people/ms/u-boot.git/blame - lib/strmhz.c
imx: hab: Check if CSF contains deprecated commands
[people/ms/u-boot.git] / lib / strmhz.c
CommitLineData
0768b7a8
HS
1/*
2 * (C) Copyright 2002-2006
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
0768b7a8
HS
6 */
7#include <common.h>
8
55f7934d 9char *strmhz (char *buf, unsigned long hz)
0768b7a8
HS
10{
11 long l, n;
12 long m;
13
4515992f 14 n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L;
0768b7a8 15 l = sprintf (buf, "%ld", n);
d50c7d4b
WD
16
17 hz -= n * 1000000L;
4515992f 18 m = DIV_ROUND_CLOSEST(hz, 1000L);
0768b7a8
HS
19 if (m != 0)
20 sprintf (buf + l, ".%03ld", m);
21 return (buf);
22}