2012-02-15 11 views

答えて

1

あなたはおそらくCFAbsoluteTimeGetCurrent()を探しています。

CFAbsoluteTime before = CFAbsoluteTimeGetCurrent(); 
// You code here 
CFAbsoluteTime after = CFAbsoluteTimeGetCurrent(); 
NSLog(@"duration = %f", after - before); 
1

2つのNSDateオブジェクトをキャプチャします.1つは関数の先頭に、もう1つは最後にキャプチャします。 timeIntervalSinceDate:を使用して、NSTimeInterval値を取得します。これは、ドキュメントに従って「サブミリ秒の精度」にまで下がります。

+0

参照:http://stackoverflow.com/questions/7686868/how-can-you-avoid-clock-exploits-in-android-games – Tocco

関連する問題