Search code examples
androidlinuxlinux-kerneladbandroid-logcat

How to sync Kernel time and logcat time?


I am working on an Android phone based on the Linux Kernel. I'm using kmsg for kernel logs and adb logcat -v time for platform logs. The problem is Kernel logs shows time from 0.000000 and logcat is showing from the start of system time ( For example, if time on the phone is 10.43.00, it'll show the first log from this time )

Now I am unable to compare events from these 2 logs as the time base ( reference) is different. Can anyone kindly point out how to sync these 2 times?


Solution

  • Pavan,

    Perhaps with you can tag your logcat prints with the time since last boot? This should be closer to the time shown in kmsg.

    Time since last boot can be retrieved with elapsedRealtime().