Is there an objective-c/iPhone version of currentTimeMillis() from Java?

前端 未结 5 1863
广开言路
广开言路 2021-02-19 03:57

I need to time some events in the app I\'m working on. In Java i used to be able to call currentTimeMillis() but there doesnt seem to be a version in Objective-c. Is there a way

5条回答
  •  耶瑟儿~
    2021-02-19 04:48

    [[NSDate date] timeIntervalSince1970] * 1000 returns a the same value as currentTimeMillis()

    CFAbsoluteTimeGetCurrent() and [NSDate timeIntervalSinceReferenceDate] both return a double starting at Jan 1 2001 00:00:00 GMT.

提交回复
热议问题