Originally Posted by DiamondJohn
Sorry if the following question is OT, but it appears to be thread which can stray...
I am trying to find a shell command or system file that reports/saves the times the device is switched on and off? I can get the battery drain from multiple places (eg dumpsys batterystats, but all the ones I have found thus far, show a time line in respect to only while the phone is on. For example, if I charge the phone to 100%, leave it on for 1hr then turn the phone off for 8hrs, then turn it on for 1hr, the details imply that the phone was on constantly for 2hrs. No reference that I can see logs that it was off for an 8hr window. Have I missed something or is there somewhere else where it is stored?
From a post I did a while back, it appears i did "miss something", as the answer was hiding in plain sight
there are lines indicating the time that the phone shuts-down and then another when it boots up. The periods in the left column of the file, are cumulative offsets of the phone up-time, irrespective of shutdown time The difficulty that was making it unclear, is that at the point in time that a shutdown/boot-up occurs, you have to reset the "times" as an offset, which could happen multiple times; so you end up with an offset on-top of an offset.
1 0 (10) RESET:TIME: 2019-10-21-16-03-53
2 +751ms (2) 100 -wifi_scan -screen brightness=dark
4102 +6h43m23s109ms (2) 086 stats=0:"shutdown"
4103 +6h43m23s125ms (8) SHUTDOWN
4104 +6h43m23s133ms (8) START
4105 +6h43m23s133ms (10) TIME: 2019-10-22-22-01-16
4106 +6h43m25s187ms (4) 089 status=discharging health=good plug=none temp=254 volt=3996 charge=0 +running stats=0:"battery-state"
So FYI, here is an example of the test of the calculated data that I plotted in excel. and compared it to my calculated results. Which includes multiple long shutdown intervals.
To be clear, my phone has the feature (Havoc-OS) (and hence something to compare it to), but I noticed a LOS ROM I tested was missing the graph.