Blame view
lib/strmhz.c
412 Bytes
0768b7a87 Consolidate strmh... |
1 2 3 4 |
/* * (C) Copyright 2002-2006 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * |
1a4596601 Add GPL-2.0+ SPDX... |
5 |
* SPDX-License-Identifier: GPL-2.0+ |
0768b7a87 Consolidate strmh... |
6 7 |
*/ #include <common.h> |
55f7934d2 strmhz: Make hz u... |
8 |
char *strmhz (char *buf, unsigned long hz) |
0768b7a87 Consolidate strmh... |
9 10 11 |
{ long l, n; long m; |
4515992fc replace DIV_ROUND... |
12 |
n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L; |
0768b7a87 Consolidate strmh... |
13 |
l = sprintf (buf, "%ld", n); |
d50c7d4be strmhz(): Round n... |
14 15 |
hz -= n * 1000000L; |
4515992fc replace DIV_ROUND... |
16 |
m = DIV_ROUND_CLOSEST(hz, 1000L); |
0768b7a87 Consolidate strmh... |
17 18 19 20 |
if (m != 0) sprintf (buf + l, ".%03ld", m); return (buf); } |