Showing the changes to kernel (2 of 3 files). Show all
Unified · Split
| @@ -114,6 +114,12 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv, · 113 unmodified lines | |||
| 114 | return 0; | 114 | return 0; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | /* | ||
| 118 | * Indicates if there is an offset between the system clock and the hardware | ||
| 119 | * clock/persistent clock/rtc. | ||
| 120 | */ | ||
| 121 | int persistent_clock_is_local; | ||
| 122 | |||
| 117 | /* | 123 | /* |
| 118 | * Adjust the time obtained from the CMOS to be UTC time instead of | 124 | * Adjust the time obtained from the CMOS to be UTC time instead of |
| 119 | * local time. | 125 | * local time. |
| @@ -135,6 +141,8 @@ static inline void warp_clock(void) · 15 unmodified lines | |||
| 135 | struct timespec adjust; | 141 | struct timespec adjust; |
| 136 | 142 | ||
| 137 | adjust = current_kernel_time(); | 143 | adjust = current_kernel_time(); |
| 144 | if (sys_tz.tz_minuteswest != 0) | ||
| 145 | persistent_clock_is_local = 1; | ||
| 138 | adjust.tv_sec += sys_tz.tz_minuteswest * 60; | 146 | adjust.tv_sec += sys_tz.tz_minuteswest * 60; |
| 139 | do_settimeofday(&adjust); | 147 | do_settimeofday(&adjust); |
| 140 | } | 148 | } |
| @@ -511,13 +511,17 @@ static void sync_cmos_clock(struct work_struct *work) · 510 unmodified lines | |||
| 511 | 511 | ||
| 512 | getnstimeofday(&now); | 512 | getnstimeofday(&now); |
| 513 | if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) { | 513 | if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) { |
| 514 | struct timespec adjust = now; | ||
| 515 | |||
| 514 | fail = -ENODEV; | 516 | fail = -ENODEV; |
| 517 | if (persistent_clock_is_local) | ||
| 518 | adjust.tv_sec -= (sys_tz.tz_minuteswest * 60); | ||
| 515 | #ifdef CONFIG_GENERIC_CMOS_UPDATE | 519 | #ifdef CONFIG_GENERIC_CMOS_UPDATE |
| 516 | fail = update_persistent_clock(now); | 520 | fail = update_persistent_clock(adjust); |
| 517 | #endif | 521 | #endif |
| 518 | #ifdef CONFIG_RTC_SYSTOHC | 522 | #ifdef CONFIG_RTC_SYSTOHC |
| 519 | if (fail == -ENODEV) | 523 | if (fail == -ENODEV) |
| 520 | fail = rtc_set_ntp_time(now); | 524 | fail = rtc_set_ntp_time(adjust); |
| 521 | #endif | 525 | #endif |
| 522 | } | 526 | } |
| 523 | 527 | ||