chiark / gitweb /
shared: rename hwclock.[ch] to clock-util.[ch]
authorKay Sievers <kay@vrfy.org>
Thu, 22 May 2014 12:21:38 +0000 (21:21 +0900)
committerKay Sievers <kay@vrfy.org>
Fri, 23 May 2014 22:56:20 +0000 (07:56 +0900)
Makefile.am
src/core/dbus-manager.c
src/core/main.c
src/hostname/hostnamectl.c
src/shared/clock-util.c [moved from src/shared/hwclock.c with 94% similarity]
src/shared/clock-util.h [moved from src/shared/hwclock.h with 81% similarity]
src/timedate/timedated.c

index cd7b6a3006dca5e13f8abc4c61bfc34b76607b96..f517f19df5f8a1dbd12a0460326bc1182f51a5a1 100644 (file)
@@ -758,8 +758,8 @@ libsystemd_shared_la_SOURCES = \
        src/shared/replace-var.h \
        src/shared/spawn-polkit-agent.c \
        src/shared/spawn-polkit-agent.h \
        src/shared/replace-var.h \
        src/shared/spawn-polkit-agent.c \
        src/shared/spawn-polkit-agent.h \
-       src/shared/hwclock.c \
-       src/shared/hwclock.h \
+       src/shared/clock-util.c \
+       src/shared/clock-util.h \
        src/shared/time-dst.c \
        src/shared/time-dst.h \
        src/shared/calendarspec.c \
        src/shared/time-dst.c \
        src/shared/time-dst.h \
        src/shared/calendarspec.c \
index d5fab0a22c31f344e83f036273ed3e9d944175f8..333c1d46e768928dafb813bcf95d05869fe0c7d9 100644 (file)
@@ -28,7 +28,7 @@
 #include "install.h"
 #include "selinux-access.h"
 #include "watchdog.h"
 #include "install.h"
 #include "selinux-access.h"
 #include "watchdog.h"
-#include "hwclock.h"
+#include "clock-util.h"
 #include "path-util.h"
 #include "virt.h"
 #include "architecture.h"
 #include "path-util.h"
 #include "virt.h"
 #include "architecture.h"
@@ -130,7 +130,7 @@ static int property_get_tainted(
         if (access("/proc/cgroups", F_OK) < 0)
                 e = stpcpy(e, "cgroups-missing:");
 
         if (access("/proc/cgroups", F_OK) < 0)
                 e = stpcpy(e, "cgroups-missing:");
 
-        if (hwclock_is_localtime() > 0)
+        if (clock_is_localtime() > 0)
                 e = stpcpy(e, "local-hwclock:");
 
         /* remove the last ':' */
                 e = stpcpy(e, "local-hwclock:");
 
         /* remove the last ':' */
index 74c50f51bea5a0ec22852c75a7daa602dfe9f136..77cc2fbbdd93d9b253f575c3aa80ba8ce4a1be94 100644 (file)
@@ -61,7 +61,7 @@
 #include "capability.h"
 #include "killall.h"
 #include "env-util.h"
 #include "capability.h"
 #include "killall.h"
 #include "env-util.h"
-#include "hwclock.h"
+#include "clock-util.h"
 #include "fileio.h"
 #include "dbus-manager.h"
 #include "bus-error.h"
 #include "fileio.h"
 #include "dbus-manager.h"
 #include "bus-error.h"
@@ -1352,11 +1352,11 @@ int main(int argc, char *argv[]) {
                         goto finish;
 
                 if (!skip_setup) {
                         goto finish;
 
                 if (!skip_setup) {
-                        if (hwclock_is_localtime() > 0) {
+                        if (clock_is_localtime() > 0) {
                                 int min;
 
                                 /* The first-time call to settimeofday() does a time warp in the kernel */
                                 int min;
 
                                 /* The first-time call to settimeofday() does a time warp in the kernel */
-                                r = hwclock_set_timezone(&min);
+                                r = clock_set_timezone(&min);
                                 if (r < 0)
                                         log_error("Failed to apply local time delta, ignoring: %s", strerror(-r));
                                 else
                                 if (r < 0)
                                         log_error("Failed to apply local time delta, ignoring: %s", strerror(-r));
                                 else
@@ -1370,10 +1370,10 @@ int main(int argc, char *argv[]) {
                                  * that way. In such case, we need to delay the time-warp or the sealing
                                  * until we reach the real system.
                                  */
                                  * that way. In such case, we need to delay the time-warp or the sealing
                                  * until we reach the real system.
                                  */
-                                hwclock_reset_timezone();
+                                clock_reset_timezone();
 
                                 /* Tell the kernel our timezone */
 
                                 /* Tell the kernel our timezone */
-                                r = hwclock_set_timezone(NULL);
+                                r = clock_set_timezone(NULL);
                                 if (r < 0)
                                         log_error("Failed to set the kernel's timezone, ignoring: %s", strerror(-r));
                         }
                                 if (r < 0)
                                         log_error("Failed to set the kernel's timezone, ignoring: %s", strerror(-r));
                         }
index 70049d31f6c7ef22b13b605d15036e260e989e01..267cd7401103b357816b9de4398ff2e0786b244c 100644 (file)
@@ -35,7 +35,7 @@
 #include "util.h"
 #include "spawn-polkit-agent.h"
 #include "build.h"
 #include "util.h"
 #include "spawn-polkit-agent.h"
 #include "build.h"
-#include "hwclock.h"
+#include "clock-util.h"
 #include "strv.h"
 #include "sd-id128.h"
 #include "virt.h"
 #include "strv.h"
 #include "sd-id128.h"
 #include "virt.h"
similarity index 94%
rename from src/shared/hwclock.c
rename to src/shared/clock-util.c
index 7059d9c75b8367a0cb1d3b39983d74087cc54f6d..15535732f7dd1407c65cf89f278f2cc95727fb49 100644 (file)
 #include "util.h"
 #include "log.h"
 #include "strv.h"
 #include "util.h"
 #include "log.h"
 #include "strv.h"
-#include "hwclock.h"
+#include "clock-util.h"
 #include "fileio.h"
 
 #include "fileio.h"
 
-int hwclock_get_time(struct tm *tm) {
+int clock_get_time(struct tm *tm) {
         _cleanup_close_ int fd = -1;
 
         assert(tm);
         _cleanup_close_ int fd = -1;
 
         assert(tm);
@@ -64,7 +64,7 @@ int hwclock_get_time(struct tm *tm) {
         return 0;
 }
 
         return 0;
 }
 
-int hwclock_set_time(const struct tm *tm) {
+int clock_set_time(const struct tm *tm) {
         _cleanup_close_ int fd = -1;
 
         assert(tm);
         _cleanup_close_ int fd = -1;
 
         assert(tm);
@@ -79,7 +79,7 @@ int hwclock_set_time(const struct tm *tm) {
         return 0;
 }
 
         return 0;
 }
 
-int hwclock_is_localtime(void) {
+int clock_is_localtime(void) {
         _cleanup_fclose_ FILE *f;
 
         /*
         _cleanup_fclose_ FILE *f;
 
         /*
@@ -109,7 +109,7 @@ int hwclock_is_localtime(void) {
         return 0;
 }
 
         return 0;
 }
 
-int hwclock_set_timezone(int *min) {
+int clock_set_timezone(int *min) {
         const struct timeval *tv_null = NULL;
         struct timespec ts;
         struct tm *tm;
         const struct timeval *tv_null = NULL;
         struct timespec ts;
         struct tm *tm;
@@ -135,7 +135,7 @@ int hwclock_set_timezone(int *min) {
         return 0;
 }
 
         return 0;
 }
 
-int hwclock_reset_timezone(void) {
+int clock_reset_timezone(void) {
         const struct timeval *tv_null = NULL;
         struct timezone tz;
 
         const struct timeval *tv_null = NULL;
         struct timezone tz;
 
similarity index 81%
rename from src/shared/hwclock.h
rename to src/shared/clock-util.h
index 4330b8ea87f17df91ae13b5c3227c44e8ddd613e..63d96fca6d1721b85ca59c5304ee8ba3a21b86cc 100644 (file)
@@ -21,8 +21,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-int hwclock_is_localtime(void);
-int hwclock_set_timezone(int *min);
-int hwclock_reset_timezone(void);
-int hwclock_get_time(struct tm *tm);
-int hwclock_set_time(const struct tm *tm);
+int clock_is_localtime(void);
+int clock_set_timezone(int *min);
+int clock_reset_timezone(void);
+int clock_get_time(struct tm *tm);
+int clock_set_time(const struct tm *tm);
index 3e0f70cfdc7c103704fb37f063fc9f141bee0408..95255def298a2e22d54b886561997a30133809ce 100644 (file)
@@ -31,7 +31,7 @@
 #include "util.h"
 #include "strv.h"
 #include "def.h"
 #include "util.h"
 #include "strv.h"
 #include "def.h"
-#include "hwclock.h"
+#include "clock-util.h"
 #include "conf-files.h"
 #include "path-util.h"
 #include "fileio-label.h"
 #include "conf-files.h"
 #include "path-util.h"
 #include "fileio-label.h"
@@ -153,7 +153,7 @@ have_timezone:
                 c->zone = NULL;
         }
 
                 c->zone = NULL;
         }
 
-        c->local_rtc = hwclock_is_localtime() > 0;
+        c->local_rtc = clock_is_localtime() > 0;
 
         return 0;
 }
 
         return 0;
 }
@@ -465,7 +465,7 @@ static int property_get_rtc_time(
         int r;
 
         zero(tm);
         int r;
 
         zero(tm);
-        r = hwclock_get_time(&tm);
+        r = clock_get_time(&tm);
         if (r == -EBUSY) {
                 log_warning("/dev/rtc is busy. Is somebody keeping it open continuously? That's not a good idea... Returning a bogus RTC timestamp.");
                 t = 0;
         if (r == -EBUSY) {
                 log_warning("/dev/rtc is busy. Is somebody keeping it open continuously? That's not a good idea... Returning a bogus RTC timestamp.");
                 t = 0;
@@ -546,7 +546,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s
         }
 
         /* 2. Tell the kernel our timezone */
         }
 
         /* 2. Tell the kernel our timezone */
-        hwclock_set_timezone(NULL);
+        clock_set_timezone(NULL);
 
         if (c->local_rtc) {
                 struct timespec ts;
 
         if (c->local_rtc) {
                 struct timespec ts;
@@ -555,7 +555,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s
                 /* 3. Sync RTC from system clock, with the new delta */
                 assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
                 assert_se(tm = localtime(&ts.tv_sec));
                 /* 3. Sync RTC from system clock, with the new delta */
                 assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
                 assert_se(tm = localtime(&ts.tv_sec));
-                hwclock_set_time(tm);
+                clock_set_time(tm);
         }
 
         log_struct(LOG_INFO,
         }
 
         log_struct(LOG_INFO,
@@ -602,7 +602,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata,
         }
 
         /* 2. Tell the kernel our timezone */
         }
 
         /* 2. Tell the kernel our timezone */
-        hwclock_set_timezone(NULL);
+        clock_set_timezone(NULL);
 
         /* 3. Synchronize clocks */
         assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
 
         /* 3. Synchronize clocks */
         assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
@@ -621,7 +621,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata,
                 /* Override the main fields of
                  * struct tm, but not the timezone
                  * fields */
                 /* Override the main fields of
                  * struct tm, but not the timezone
                  * fields */
-                if (hwclock_get_time(&tm) >= 0) {
+                if (clock_get_time(&tm) >= 0) {
 
                         /* And set the system clock
                          * with this */
 
                         /* And set the system clock
                          * with this */
@@ -642,7 +642,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata,
                 else
                         tm = gmtime(&ts.tv_sec);
 
                 else
                         tm = gmtime(&ts.tv_sec);
 
-                hwclock_set_time(tm);
+                clock_set_time(tm);
         }
 
         log_info("RTC configured to %s time.", c->local_rtc ? "local" : "UTC");
         }
 
         log_info("RTC configured to %s time.", c->local_rtc ? "local" : "UTC");
@@ -706,7 +706,7 @@ static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu
         else
                 tm = gmtime(&ts.tv_sec);
 
         else
                 tm = gmtime(&ts.tv_sec);
 
-        hwclock_set_time(tm);
+        clock_set_time(tm);
 
         log_struct(LOG_INFO,
                    MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),
 
         log_struct(LOG_INFO,
                    MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),