Skip to content

Commit 458bfdb

Browse files
kdrag0ncyberknight777
authored andcommitted
printk: Add sleep time offset to all timestamps
Instrumenting print_time is insufficient for adjusting the timestamp of logged messages. Add the sleep time offset to true message timestamps as well to address this issue. Test: dmesg shows true boot time after several suspend/resume cycles Signed-off-by: Danny Lin <danny@kdrag0n.dev> Signed-off-by: Fiqri Ardyansyah <fiqri15072019@gmail.com> Signed-off-by: Forenche <prahul2003@gmail.com> Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
1 parent 18f135c commit 458bfdb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/printk/printk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ static int log_store(int facility, int level,
629629
if (ts_nsec > 0)
630630
msg->ts_nsec = ts_nsec;
631631
else
632-
msg->ts_nsec = local_clock();
632+
msg->ts_nsec = local_clock() + get_total_sleep_time_nsec();
633633
memset(log_dict(msg) + dict_len, 0, pad_len);
634634
msg->len = size;
635635

@@ -1793,7 +1793,7 @@ static bool cont_add(int facility, int level, enum log_flags flags, const char *
17931793
cont.facility = facility;
17941794
cont.level = level;
17951795
cont.owner = current;
1796-
cont.ts_nsec = local_clock();
1796+
cont.ts_nsec = local_clock() + get_total_sleep_time_nsec();
17971797
cont.flags = flags;
17981798
}
17991799

0 commit comments

Comments
 (0)