goto finish;
if (hwclock_is_localtime() > 0) {
- int min;
+ int err, min;
- min = hwclock_apply_localtime_delta();
- if (min < 0)
- log_error("Failed to apply local time delta: %s", strerror(-min));
+ err = hwclock_apply_localtime_delta(&min);
+ if (err < 0)
+ log_error("Failed to apply local time delta: %s", strerror(-err));
else
log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
}
struct tm *tm;
/* 2. Teach kernel new timezone */
- hwclock_apply_localtime_delta();
+ hwclock_apply_localtime_delta(NULL);
/* 3. Sync RTC from system clock, with the new delta */
assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
/* 2. Teach kernel new timezone */
if (local_rtc)
- hwclock_apply_localtime_delta();
+ hwclock_apply_localtime_delta(NULL);
else
hwclock_reset_localtime_delta();
return local;
}
-int hwclock_apply_localtime_delta(void) {
+int hwclock_apply_localtime_delta(int *min) {
const struct timeval *tv_null = NULL;
struct timespec ts;
struct tm *tm;
*/
if (settimeofday(tv_null, &tz) < 0)
return -errno;
-
- return minuteswest;
+ if (min)
+ *min = minuteswest;
+ return 0;
}
int hwclock_reset_localtime_delta(void) {
int conf_files_list(char ***strv, const char *suffix, const char *dir, ...);
int hwclock_is_localtime(void);
-
-int hwclock_apply_localtime_delta(void);
+int hwclock_apply_localtime_delta(int *min);
int hwclock_reset_localtime_delta(void);
int hwclock_get_time(struct tm *tm);
int hwclock_set_time(const struct tm *tm);