aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPStringAdditions.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-06-27 14:27:10 +0000
committerrowanbeentje <rowan@beent.je>2009-06-27 14:27:10 +0000
commitcd7bc33e901ca84efa53dd5a26c837b5918a3b10 (patch)
tree9ea82f1f36ac3ecf96a3f34149266ca5bf0f842f /Source/SPStringAdditions.m
parentdd93ba60cc062ce4a733338ff993acf4db7cc537 (diff)
downloadsequelpro-cd7bc33e901ca84efa53dd5a26c837b5918a3b10.tar.gz
sequelpro-cd7bc33e901ca84efa53dd5a26c837b5918a3b10.tar.bz2
sequelpro-cd7bc33e901ca84efa53dd5a26c837b5918a3b10.zip
Improve custom query timing and display:
- Amend timing using clock() to timing based on mach_absolute_time() (see revision comment on Google code) - Ensure the time returned is for the requested query and not subsequent helper queries - Use NSNumberFormatter to return a localised "< 0.1 ms" rather than the hardcoded Euro-style "< 0,1 ms"
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r--Source/SPStringAdditions.m10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index fef2d763..114ecf7d 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -74,17 +74,17 @@
//
// Returns a human readable version string of the supplied time interval.
// -------------------------------------------------------------------------------
-+ (NSString *)stringForTimeInterval:(float)timeInterval intervalInClocks:(BOOL)inClocks
++ (NSString *)stringForTimeInterval:(float)timeInterval
{
NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
- if(inClocks)
- timeInterval = timeInterval/CLOCKS_PER_SEC;
-
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
+ // For time periods of less than one millisecond, display a localised "< 0.1 ms"
if (timeInterval < 0.0001) {
- return @"< 0,1 ms";
+ [numberFormatter setFormat:@"< #,##0.0 ms"];
+
+ return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:0.1]];
}
if (timeInterval < 0.1) {