如何从上次启动获取NSTimeInterval值(How to get NSTimeInterval value from last boot)

编程入门 行业动态 更新时间:2024-10-28 06:32:31
如何从上次启动获取NSTimeInterval值(How to get NSTimeInterval value from last boot)

我需要从上次设备启动时获取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]

更多推荐

本文发布于:2023-07-27 18:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1294015.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NSTimeInterval   boot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!