Skip to content

Instantly share code, notes, and snippets.

@codeinpeace
Forked from antirez/gist:932108
Created April 21, 2011 03:41
Show Gist options
  • Save codeinpeace/933669 to your computer and use it in GitHub Desktop.
Save codeinpeace/933669 to your computer and use it in GitHub Desktop.
diff --git a/iPhoneTrackingAppDelegate.m b/iPhoneTrackingAppDelegate.m
index 1d22ecb..4af2bcf 100644
--- a/iPhoneTrackingAppDelegate.m
+++ b/iPhoneTrackingAppDelegate.m
@@ -146,7 +146,7 @@
return NO;
}
- const float precision = 100;
+ const float precision = 10000;
NSMutableDictionary* buckets = [NSMutableDictionary dictionary];
NSString* queries[] = {@"SELECT * FROM CellLocation;", @"SELECT * FROM WifiLocation;"};
@@ -176,12 +176,12 @@
continue;
}
- const float weekInSeconds = (7*24*60*60);
+ const float weekInSeconds = (360);
const float timeBucket = (floor(unixTimestamp/weekInSeconds)*weekInSeconds);
NSDate* timeBucketDate = [NSDate dateWithTimeIntervalSince1970:timeBucket];
- NSString* timeBucketString = [timeBucketDate descriptionWithCalendarFormat:@"%Y-%m-%d" timeZone:nil locale:nil];
+ NSString* timeBucketString = [timeBucketDate descriptionWithCalendarFormat:@"%Y-%m-%d-%H" timeZone:nil locale:nil];
const float latitude_index = (floor(latitude*precision)/precision);
const float longitude_index = (floor(longitude*precision)/precision);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment