Unix dmesg timestamp

Handy script to convert unix’s dmesg timestamp to a human readable format – dmesg_realtime.sh:

1
2
3
4
5
#!/bin/bash
ut=`cut -d' ' -f1 < /proc/uptime`
ts=`date +%s`
realtime_date=`date -d"70-1-1 + $ts sec - $ut sec + $1 sec" +"%F %T"`
echo $realtime_date

Usage:

1
2
3
4
5
6
7
$ dmesg
...
...
[102927.525349] 954929 pages non-shared

$ ./dmesg_realtime.sh 102927.525349
2014-06-17 13:59:17

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>