diff options
author | Sami Kerola | 2014-09-28 21:51:51 +0200 |
---|---|---|
committer | Karel Zak | 2014-10-01 13:09:36 +0200 |
commit | 83aa4ad7975ef3acadff62d9afab973e0feccdb7 (patch) | |
tree | 21ec4002dfb81fb0d5919dfc0d35bbef35ebe023 /sys-utils/hwclock.c | |
parent | include/debug: remove duplicate 'const' declaration warning (diff) | |
download | kernel-qcow2-util-linux-83aa4ad7975ef3acadff62d9afab973e0feccdb7.tar.gz kernel-qcow2-util-linux-83aa4ad7975ef3acadff62d9afab973e0feccdb7.tar.xz kernel-qcow2-util-linux-83aa4ad7975ef3acadff62d9afab973e0feccdb7.zip |
hwclock: use fabs() instead abs() when argument is double
sys-utils/hwclock.c:1219:13: warning: using integer absolute value function
'abs' when argument is of floating point type [-Wabsolute-value]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r-- | sys-utils/hwclock.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 493ee8808..e7801583b 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -60,6 +60,7 @@ #include <errno.h> #include <getopt.h> #include <limits.h> +#include <math.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -1042,7 +1043,7 @@ adjust_drift_factor(struct adjtime *adjtime_p, /* New drift factor */ drift_factor = adjtime_p->drift_factor + factor_adjust; - if (abs(drift_factor) > MAX_DRIFT) { + if (fabs(drift_factor) > MAX_DRIFT) { if (debug) printf(_("Clock drift factor was calculated as " "%f seconds/day.\n" @@ -1215,7 +1216,7 @@ do_adjustment(struct adjtime *adjtime_p, if (debug) printf(_("Not setting clock because last adjustment time is zero, " "so history is bad.\n")); - } else if (abs(adjtime_p->drift_factor) > MAX_DRIFT) { + } else if (fabs(adjtime_p->drift_factor) > MAX_DRIFT) { if (debug) printf(_("Not setting clock because drift factor %f is far too high.\n"), adjtime_p->drift_factor); |