]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
timedated: make ntp_synced() static
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 12 May 2021 07:39:28 +0000 (09:39 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 12 May 2021 10:05:21 +0000 (12:05 +0200)
No need to have this in basic.

src/basic/time-util.c
src/basic/time-util.h
src/timedate/timedated.c

index 6b3b42254d504c55f03d04fe766c9ffb12e4e8c6..b6087c455030c51e30dd66e20a70469f94d08d6f 100644 (file)
@@ -7,7 +7,6 @@
 #include <sys/mman.h>
 #include <sys/time.h>
 #include <sys/timerfd.h>
-#include <sys/timex.h>
 #include <sys/types.h>
 #include <unistd.h>
 
@@ -1245,21 +1244,6 @@ int parse_nsec(const char *t, nsec_t *nsec) {
         return 0;
 }
 
-bool ntp_synced(void) {
-        struct timex txc = {};
-
-        if (adjtimex(&txc) < 0)
-                return false;
-
-        /* Consider the system clock synchronized if the reported maximum error is smaller than the maximum
-         * value (16 seconds). Ignore the STA_UNSYNC flag as it may have been set to prevent the kernel from
-         * touching the RTC. */
-        if (txc.maxerror >= 16000000)
-                return false;
-
-        return true;
-}
-
 int get_timezones(char ***ret) {
         _cleanup_fclose_ FILE *f = NULL;
         _cleanup_strv_free_ char **zones = NULL;
index d716074fbe3a28bc2408643a1cec8d8bdbe60099..cfde189818b934dd607faf1ee447d3b0d6982d86 100644 (file)
@@ -133,8 +133,6 @@ int parse_sec_def_infinity(const char *t, usec_t *usec);
 int parse_time(const char *t, usec_t *usec, usec_t default_unit);
 int parse_nsec(const char *t, nsec_t *nsec);
 
-bool ntp_synced(void);
-
 int get_timezones(char ***l);
 bool timezone_is_valid(const char *name, int log_level);
 
index 6e0f91dec47ddff9f948d5964695bf1f9ce63a1f..66b454269d73bd5147e657684c5985e79c104455 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <errno.h>
 #include <sys/stat.h>
+#include <sys/timex.h>
 #include <sys/types.h>
 #include <unistd.h>
 
@@ -556,6 +557,18 @@ static int unit_enable_or_disable(UnitStatusInfo *u, sd_bus *bus, sd_bus_error *
         return 0;
 }
 
+static bool ntp_synced(void) {
+        struct timex txc = {};
+
+        if (adjtimex(&txc) < 0)
+                return false;
+
+        /* Consider the system clock synchronized if the reported maximum error is smaller than the maximum
+         * value (16 seconds). Ignore the STA_UNSYNC flag as it may have been set to prevent the kernel from
+         * touching the RTC. */
+        return txc.maxerror < 16000000;
+}
+
 static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_time, "t", now(CLOCK_REALTIME));
 static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_ntp_sync, "b", ntp_synced());