iPhone: How to get current milliseconds?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: What is the best way to get the current system time milliseconds? 回答1: [[ NSDate date ] timeIntervalSince1970 ]; It returns the number of seconds since epoch as a double. I'm almost sure you can access the milliseconds from the fractional part. 回答2: If you're looking at using this for relative timing (for example for games or animation) I'd rather use CACurrentMediaTime() double CurrentTime = CACurrentMediaTime (); Which is the recommended way; NSDate draws from the networked synch-clock and will occasionally hiccup when re