我需要从上次设备启动时获取NSTimeInterval值。 我发现适合这个任务的CACurrentMediaTime(),但是在我的应用程序中,我没有使用Core Animation,并且我不认为这是包含这个框架的最好方法,只是为了获得这个功能。 有没有另一种方式让上次开机时间更加优雅?
I need to get NSTimeInterval value from last device boot. I found CACurrentMediaTime() which suits this task, but in my app I am not using Core Animation and I don't think that this is the best way to include this framework just to get this function. Is there another way to get time in seconds from last boot more elegant way?
最满意答案
自上次系统重新启动以来的NSTimeInterval值可以通过以下基础对象和方法直接获取:
[[NSProcessInfo processInfo] systemUptime]
The NSTimeInterval value since the last system restart can be acquired more directly via the following Foundation object and method:
[[NSProcessInfo processInfo] systemUptime]
更多推荐
发布评论