iOS: How to measure passed time, independent of clock and time zone changes?

前端 未结 2 627
挽巷
挽巷 2021-01-16 15:03

In order to measure the time duration while my app is running, as well as the time that passed while my app was idle in the background, I need a reference clock that is not

相关标签:
2条回答
  • 2021-01-16 16:06

    Are you looking for something like this?

    http://www.wand.net.nz/~smr26/wordpress/2009/01/19/monotonic-time-in-mac-os-x/

    0 讨论(0)
  • 2021-01-16 16:07

    #include <mach/mach_time.h> into your source file.

    replace any calls to clock_gettime(CLOCK_MONOTONIC, &timespec_t) with calls to mach_absolute_time().

    0 讨论(0)
提交回复
热议问题