chiark / gitweb /
bus: reuse more code
[elogind.git] / src / shared / hwclock.c
index 0e8fa45971325704640a701af5666d8e50c76684..488c30e93f6c8ce04dfb2da451b4c60022b0c9c4 100644 (file)
@@ -41,6 +41,7 @@
 #include "log.h"
 #include "strv.h"
 #include "hwclock.h"
+#include "fileio.h"
 
 static int rtc_open(int flags) {
         int fd;
@@ -199,14 +200,14 @@ int hwclock_set_timezone(int *min) {
         const struct timeval *tv_null = NULL;
         struct timespec ts;
         struct tm *tm;
-        int minuteswest;
+        int minutesdelta;
         struct timezone tz;
 
         assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
         assert_se(tm = localtime(&ts.tv_sec));
-        minuteswest = tm->tm_gmtoff / 60;
+        minutesdelta = tm->tm_gmtoff / 60;
 
-        tz.tz_minuteswest = -minuteswest;
+        tz.tz_minuteswest = -minutesdelta;
         tz.tz_dsttime = 0; /* DST_NONE*/
 
         /*
@@ -217,7 +218,7 @@ int hwclock_set_timezone(int *min) {
         if (settimeofday(tv_null, &tz) < 0)
                 return -errno;
         if (min)
-                *min = minuteswest;
+                *min = minutesdelta;
         return 0;
 }