X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fclock-util.c;h=96684681a40760392255ba01ff370c54debae1b8;hp=e66db63ba01263eaac26339bb13294f8e0382e4c;hb=b6b1849830f5e4a6065c3b0c993668e500c954d3;hpb=609896125cb89cac2fcd5b80b532de97d7a64c0a diff --git a/src/shared/clock-util.c b/src/shared/clock-util.c index e66db63ba..96684681a 100644 --- a/src/shared/clock-util.c +++ b/src/shared/clock-util.c @@ -121,12 +121,13 @@ int clock_set_timezone(int *min) { minutesdelta = tm->tm_gmtoff / 60; tz.tz_minuteswest = -minutesdelta; - tz.tz_dsttime = 0; /* DST_NONE*/ + tz.tz_dsttime = 0; /* DST_NONE */ /* - * If the hardware clock does not run in UTC, but in local time: - * The very first time we set the kernel's timezone, it will warp - * the clock so that it runs in UTC instead of local time. + * If the RTC does not run in UTC but in local time, the very first + * call to settimeofday() will set the kernel's timezone and will warp the + * system clock, so that it runs in UTC instead of the local time we + * have read from the RTC. */ if (settimeofday(tv_null, &tz) < 0) return -errno; @@ -135,17 +136,17 @@ int clock_set_timezone(int *min) { return 0; } -int clock_reset_timezone(void) { +int clock_reset_timewarp(void) { const struct timeval *tv_null = NULL; struct timezone tz; tz.tz_minuteswest = 0; - tz.tz_dsttime = 0; /* DST_NONE*/ + 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 timezone with the next call. + * The very first call to settimeofday() does time warp magic. Do a + * dummy call here, so the time warping is sealed and all later calls + * behave as expected. */ if (settimeofday(tv_null, &tz) < 0) return -errno;