Created
March 31, 2022 15:18
-
-
Save greg76/80ac6d89cd587eb6fb4b6b2865bc8e59 to your computer and use it in GitHub Desktop.
check the time of the last kernel panic on you mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import datetime | |
with os.popen("nvram -p") as out: | |
ts_line = next((line for line in out.readlines() if line.startswith("panicmedic-timestamps")), None) | |
if ts_line: | |
ts_hex = ts_line.split("\t")[-1] | |
ts_int = int(ts_hex, 16) | |
ts = datetime.datetime.fromtimestamp(ts_int // 1000000) | |
print(f"Last kernel panic: {ts}") | |
else: | |
print("There's no kernel panic reported in NVRAM.") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment