chiark / gitweb /
clock-util: clock_[sg]et_time() -> clock_[sg]et_hwclock()
authorKay Sievers <kay@vrfy.org>
Sat, 24 May 2014 02:26:33 +0000 (10:26 +0800)
committerKay Sievers <kay@vrfy.org>
Sat, 24 May 2014 02:26:33 +0000 (10:26 +0800)
src/shared/clock-util.c
src/shared/clock-util.h
src/timedate/timedated.c

index 4f31c10b816ed0a60b5ff0c211f2a6b412eb7127..e66db63ba01263eaac26339bb13294f8e0382e4c 100644 (file)
@@ -43,7 +43,7 @@
 #include "clock-util.h"
 #include "fileio.h"
 
 #include "clock-util.h"
 #include "fileio.h"
 
-int clock_get_time(struct tm *tm) {
+int clock_get_hwclock(struct tm *tm) {
         _cleanup_close_ int fd = -1;
 
         assert(tm);
         _cleanup_close_ int fd = -1;
 
         assert(tm);
@@ -64,7 +64,7 @@ int clock_get_time(struct tm *tm) {
         return 0;
 }
 
         return 0;
 }
 
-int clock_set_time(const struct tm *tm) {
+int clock_set_hwclock(const struct tm *tm) {
         _cleanup_close_ int fd = -1;
 
         assert(tm);
         _cleanup_close_ int fd = -1;
 
         assert(tm);
index 63d96fca6d1721b85ca59c5304ee8ba3a21b86cc..4deeac773600ec06a641dfb2271c9c37faa3c985 100644 (file)
@@ -24,5 +24,5 @@
 int clock_is_localtime(void);
 int clock_set_timezone(int *min);
 int clock_reset_timezone(void);
 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);
+int clock_get_hwclock(struct tm *tm);
+int clock_set_hwclock(const struct tm *tm);
index 95255def298a2e22d54b886561997a30133809ce..0e74c25b05abab13dbceca2979f9027b61caa297 100644 (file)
@@ -465,7 +465,7 @@ static int property_get_rtc_time(
         int r;
 
         zero(tm);
         int r;
 
         zero(tm);
-        r = clock_get_time(&tm);
+        r = clock_get_hwclock(&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;
@@ -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));
-                clock_set_time(tm);
+                clock_set_hwclock(tm);
         }
 
         log_struct(LOG_INFO,
         }
 
         log_struct(LOG_INFO,
@@ -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 (clock_get_time(&tm) >= 0) {
+                if (clock_get_hwclock(&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);
 
-                clock_set_time(tm);
+                clock_set_hwclock(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");
@@ -705,8 +705,7 @@ static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu
                 tm = localtime(&ts.tv_sec);
         else
                 tm = gmtime(&ts.tv_sec);
                 tm = localtime(&ts.tv_sec);
         else
                 tm = gmtime(&ts.tv_sec);
-
-        clock_set_time(tm);
+        clock_set_hwclock(tm);
 
         log_struct(LOG_INFO,
                    MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),
 
         log_struct(LOG_INFO,
                    MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),