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 cd7b6a3..f517f19 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/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 \
index d5fab0a..333c1d4 100644 (file)
@@ -28,7 +28,7 @@
 #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"
@@ -130,7 +130,7 @@ static int property_get_tainted(
         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 ':' */
index 74c50f5..77cc2fb 100644 (file)
@@ -61,7 +61,7 @@
 #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"
@@ -1352,11 +1352,11 @@ int main(int argc, char *argv[]) {
                         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 */
-                                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
@@ -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.
                                  */
-                                hwclock_reset_timezone();
+                                clock_reset_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));
                         }
index 70049d3..267cd74 100644 (file)
@@ -35,7 +35,7 @@
 #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"
similarity index 94%
rename from src/shared/hwclock.c
rename to src/shared/clock-util.c
index 7059d9c..1553573 100644 (file)
 #include "util.h"
 #include "log.h"
 #include "strv.h"
-#include "hwclock.h"
+#include "clock-util.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);
@@ -64,7 +64,7 @@ int hwclock_get_time(struct tm *tm) {
         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);
@@ -79,7 +79,7 @@ int hwclock_set_time(const struct tm *tm) {
         return 0;
 }
 
-int hwclock_is_localtime(void) {
+int clock_is_localtime(void) {
         _cleanup_fclose_ FILE *f;
 
         /*
@@ -109,7 +109,7 @@ int hwclock_is_localtime(void) {
         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;
@@ -135,7 +135,7 @@ int hwclock_set_timezone(int *min) {
         return 0;
 }
 
-int hwclock_reset_timezone(void) {
+int clock_reset_timezone(void) {
         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 4330b8e..63d96fc 100644 (file)
@@ -21,8 +21,8 @@
   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 3e0f70c..95255de 100644 (file)
@@ -31,7 +31,7 @@
 #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"
@@ -153,7 +153,7 @@ have_timezone:
                 c->zone = NULL;
         }
 
-        c->local_rtc = hwclock_is_localtime() > 0;
+        c->local_rtc = clock_is_localtime() > 0;
 
         return 0;
 }
@@ -465,7 +465,7 @@ static int property_get_rtc_time(
         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;
@@ -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 */
-        hwclock_set_timezone(NULL);
+        clock_set_timezone(NULL);
 
         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));
-                hwclock_set_time(tm);
+                clock_set_time(tm);
         }
 
         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 */
-        hwclock_set_timezone(NULL);
+        clock_set_timezone(NULL);
 
         /* 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 */
-                if (hwclock_get_time(&tm) >= 0) {
+                if (clock_get_time(&tm) >= 0) {
 
                         /* 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);
 
-                hwclock_set_time(tm);
+                clock_set_time(tm);
         }
 
         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);
 
-        hwclock_set_time(tm);
+        clock_set_time(tm);
 
         log_struct(LOG_INFO,
                    MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),