[英]In iOS, using Swift, how do you get the time of iPhone boot?
In core motion, data is returned in a class inheriting from CMLogItem
, which has a timestamp
property.在核心运动中,数据在继承自CMLogItem
的类中返回,该类具有timestamp
属性。 The timestamp
is a TimeInterval
that is the time since the device booted. timestamp
是一个TimeInterval
,它是自设备启动以来的时间。
How do I get when the device booted?设备启动时如何获取?
From the comments, I was able to find ProcessInfo.processInfo.systemUptime
which is the time since last boot.从评论中,我能够找到ProcessInfo.processInfo.systemUptime
这是自上次启动以来的时间。 From this, and Date()
, I can get the time of start via:从此和Date()
,我可以通过以下方式获得开始时间:
time_of_last_boot = Date() - ProcessInfo.processInfo.systemUptime
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.