If architecture does not support exact boot time, it is challenging to estimate boot time without having a reference to the current persistent clock value. Yet, it cannot read the persistent clock time again, because this may lead to math discrepancies with the caller of read_boot_clock64() who have read the persistent clock at a different time. This is why it is better to provide two values simultaneously: the persistent clock value, and the boot time. Replace read_boot_clock64() with: read_persistent_wall_and_boot_offset(wall_time, boot_offset) Where wall_time is returned by read_persistent_clock() And boot_offset is wall_time - boot time, which defaults to 0.
Showing the changes to include (1 of 2 files). Show all
Unified · Split
| @@ -243,7 +243,8 @@ extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot); · 242 unmodified lines | |||
| 243 | extern int persistent_clock_is_local; | 243 | extern int persistent_clock_is_local; |
| 244 | 244 | ||
| 245 | extern void read_persistent_clock64(struct timespec64 *ts); | 245 | extern void read_persistent_clock64(struct timespec64 *ts); |
| 246 | extern void read_boot_clock64(struct timespec64 *ts); | 246 | void read_persistent_clock_and_boot_offset(struct timespec64 *wall_clock, |
| 247 | struct timespec64 *boot_offset); | ||
| 247 | extern int update_persistent_clock64(struct timespec64 now); | 248 | extern int update_persistent_clock64(struct timespec64 now); |
| 248 | 249 | ||
| 249 | /* | 250 | /* |