diff options
author | Cristian Rodríguez <crrodriguez@opensuse.org> | 2014-12-23 17:52:51 -0300 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-12-25 10:55:41 -0500 |
commit | fa66b606b1a79530bc0d7f70ff30955232e40694 (patch) | |
tree | 7699de43f2da6b27deef563db5706c91bb308283 /src/timesync/timesyncd-manager.c | |
parent | 097df453dab149f6b45f1b30510363acd8f11593 (diff) |
timesync: remove square(), use pow instead
In any case, the compiler generates the same code inline and never
actually calls the library function.
Diffstat (limited to 'src/timesync/timesyncd-manager.c')
-rw-r--r-- | src/timesync/timesyncd-manager.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c index ef5854d07e..117ea8c98d 100644 --- a/src/timesync/timesyncd-manager.c +++ b/src/timesync/timesyncd-manager.c @@ -147,10 +147,6 @@ static double ts_to_d(const struct timespec *ts) { return ts->tv_sec + (1.0e-9 * ts->tv_nsec); } -static double square(double d) { - return d * d; -} - static int manager_timeout(sd_event_source *source, usec_t usec, void *userdata) { _cleanup_free_ char *pretty = NULL; Manager *m = userdata; @@ -428,7 +424,7 @@ static bool manager_sample_spike_detection(Manager *m, double offset, double del j = 0; for (i = 0; i < ELEMENTSOF(m->samples); i++) - j += square(m->samples[i].offset - m->samples[idx_min].offset); + j += pow(m->samples[i].offset - m->samples[idx_min].offset, 2); m->samples_jitter = sqrt(j / (ELEMENTSOF(m->samples) - 1)); /* ignore samples when resyncing */ |