[ad_1]
In my Obj C code, I wish to know the time taken by a completion handler to return end result. That is how I measure the length:
NSDate *begin = [NSDate date];
[_client asyncCallWithInput:@"INPUT" completionHandler:^(Output output, NSError * _Nullable error) {
[recordMetricWithDuration fabs([start timeIntervalSinceNow]];
}]
However once I take a look at the recorded values for this I see them within the order of 1000s and round 4k minimal. That is clearly incorrect as a result of 4k seconds is greater than an hour and I do know the perform doesn’t take that lengthy. (timeIntervalSinceNow returns a NSTimeInterval which “is all the time laid out in seconds”)
Elsewhere within the code I see this used, which appears to be giving appropriate worth.
CFTimeInterval begin = CACurrentMediaTime();
...
CFTimeInterval length = CACurrentMediaTime() - begin;
What am I lacking? From the docs for [NSDate date] “Creates and returns a brand new date object set to the present date and time.”, so I ought to be getting appropriate worth too.
Edit:
I simply realized that the place the place I report length wants the length to be of kind CFTimeInterval however I’m passing it NSTimeInterval. Possibly that’s inflicting a problem?
[ad_2]
