[systemd-commits] src/core src/shared

Kay Sievers kay at kemper.freedesktop.org
Sat Oct 27 07:31:16 PDT 2012


 src/core/main.c      |   11 +++++++++--
 src/shared/hwclock.c |    8 ++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 19e65613563dd9c14cf1ce58aa6e151de8fb90c2
Author: Kay Sievers <kay at vrfy.org>
Date:   Sat Oct 27 16:23:32 2012 +0200

    hwclock: do not seal the kernel's time-warp call from inside the initrd

diff --git a/src/core/main.c b/src/core/main.c
index e094efe..4da8ecb 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1350,8 +1350,15 @@ int main(int argc, char *argv[]) {
                                         log_error("Failed to apply local time delta, ignoring: %s", strerror(-r));
                                 else
                                         log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
-                        } else {
-                                /* Do dummy first-time call to seal the kernel's time warp magic */
+                        } else if (!in_initrd()) {
+                                /*
+                                 * Do dummy first-time call to seal the kernel's time warp magic
+                                 *
+                                 * Do not call this this from inside the initrd. The initrd might not
+                                 * carry /etc/adjtime with LOCAL, but the real system could be set up
+                                 * that way. In such case, we need to delay the time-warp or the sealing
+                                 * until we reach the real system.
+                                 */
                                 hwclock_reset_timezone();
 
                                 /* Tell the kernel our time zone */
diff --git a/src/shared/hwclock.c b/src/shared/hwclock.c
index 0e8fa45..f9adf03 100644
--- a/src/shared/hwclock.c
+++ b/src/shared/hwclock.c
@@ -199,14 +199,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 +217,7 @@ int hwclock_set_timezone(int *min) {
         if (settimeofday(tv_null, &tz) < 0)
                 return -errno;
         if (min)
-                *min = minuteswest;
+                *min = minutesdelta;
         return 0;
 }
 



More information about the systemd-commits mailing list