chiark / gitweb /
main: when transitioning from initrd to the main system log to kmsg
[elogind.git] / src / shared / hwclock.c
index d40bb2653f886b5ef70b70c53d94aaa15d7715b4..67eb2eff8b0782c0a650f6418dc08527949d836f 100644 (file)
@@ -74,7 +74,7 @@ static int rtc_open(int flags) {
                 if (ignore_file(de->d_name))
                         continue;
 
-                p = join("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
+                p = strjoin("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
                 if (!p) {
                         closedir(d);
                         return -ENOMEM;
@@ -154,6 +154,7 @@ int hwclock_set_time(const struct tm *tm) {
 
         return err;
 }
+
 int hwclock_is_localtime(void) {
         FILE *f;
         bool local = false;
@@ -188,7 +189,7 @@ int hwclock_is_localtime(void) {
         return local;
 }
 
-int hwclock_apply_localtime_delta(int *min) {
+int hwclock_set_timezone(int *min) {
         const struct timeval *tv_null = NULL;
         struct timespec ts;
         struct tm *tm;
@@ -214,13 +215,18 @@ int hwclock_apply_localtime_delta(int *min) {
         return 0;
 }
 
-int hwclock_reset_localtime_delta(void) {
+int hwclock_reset_timezone(void) {
         const struct timeval *tv_null = NULL;
         struct timezone tz;
 
         tz.tz_minuteswest = 0;
         tz.tz_dsttime = 0; /* DST_NONE*/
 
+        /*
+         * The very first time we set the kernel's timezone, it will warp
+         * the clock. Do a dummy call here, so the time warping is sealed
+         * and we set only the time zone with next call.
+         */
         if (settimeofday(tv_null, &tz) < 0)
                 return -errno;