-
Re: Identify device last reboot time
eskimo Nov 11, 2019 1:07 AM (in response to Peter2131)What I’d do in your situation is get the current current time, get the boot time (see this post), and diff them to get the up time [1]. Then subtract that up time from a timestamp you get from the network. That will give you a similarly trusted timestamp for the boot time.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardwarelet myEmail = "eskimo" + "1" + "@apple.com"
[1] The fact that the boot time changes when the system clock changes means that that this difference is always meaningful.
-
Re: Identify device last reboot time
Peter2131 Nov 11, 2019 10:22 AM (in response to eskimo)Thank You Eskimo for your response
question
(1) Not sure i understand timestamp from network i dont get any time from server
(2) For current time any suggestions? should i use timesince1970??
-
Re: Identify device last reboot time
eskimo Nov 12, 2019 12:48 AM (in response to Peter2131)Not sure i understand timestamp from network i dont get any time from server
I’m suggesting you use the network to contact a server you trust to get the time. It’s not possible to trust any timestamp you get locally because, as you’ve noticed, the user can change the time.
For current time any suggestions? should i use
timesince1970
??If I’m working at this layer of the system I generally use
gettimeofday
. It works in the same units askern.boottime
. Alternatively you can map thekern.boottime
value toNSDate
and work inNSDate
space. It doesn’t really matter.Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardwarelet myEmail = "eskimo" + "1" + "@apple.com"
-
-