将dmesg时间戳转换为自定义日期格式 [英] Convert dmesg timestamp to custom date format
本文介绍了将dmesg时间戳转换为自定义日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图理解dmesg时间戳,并发现很难将其转换为Java日期/自定义日期格式.
I am trying to understand the dmesg timestamp and find it hard to convert that to change it to java date/custom date format.
非常感谢您的帮助.
示例dmesg日志:
[14614.647880] airo(eth1): link lost (missed beacons)
谢谢!
推荐答案
了解dmesg
时间戳非常简单:它是内核启动以来的时间(以秒为单位).因此,有了启动时间(uptime
),您可以将秒数加起来并以您喜欢的任何格式显示它们.
Understanding dmesg
timestamp is pretty simple: it is time in seconds since the kernel started. So, having time of startup (uptime
), you can add up the seconds and show them in whatever format you like.
或者更好的是,您可以使用dmesg
的-T
命令行选项并解析人类可读的格式.
Or better, you could use the -T
command line option of dmesg
and parse the human readable format.
在手册页中:>
-T, --ctime
Print human readable timestamps. The timestamp could be inaccurate!
The time source used for the logs is not updated after system SUSPEND/RESUME.
这篇关于将dmesg时间戳转换为自定义日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文