繁体   English   中英

如何从proc文件中获取系统时间?

[英]How can I get system time from a proc file?

如何从proc文件中获取系统时间? 我知道我们可以从日期等命令中获取系统时间,也可以根据时间API编写一些代码。 但我真的需要使用一个简单的proc文件来获取时间。 无论时间格式是什么,简单的值都可以。 例如,从1970/1/1开始的总秒数非常好。

是的你可以 :

cat /proc/driver/rtc

来自男人:

RTC vs system clock
   RTCs should not be confused with the system clock, which is a
   software clock maintained by the kernel and used to implement
   gettimeofday(2) and time(2), as well as setting timestamps on files,
   and so on.  The system clock reports seconds and microseconds since a
   start point, defined to be the POSIX Epoch: 1970-01-01 00:00:00 +0000
   (UTC).

更多这里

您可以获得自/proc/uptime启动系统以来的/proc/uptime ,但我无法从/proc获取实时。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM