views:

55

answers:

1

How does this condition work? I'm unable to comprehend this.

if ([newLocation.timestamp timeIntervalSince1970] < [NSDate timeIntervalSinceReferenceDate] - 60) return;

Reference: More iPhone 3 Development - Tackling iPhone SDK 3

+1  A: 

I'll go with what Jason suggested. I wrote a blog post for this on the book's forum but i never heard back!

"This condition doesn't work reliably, assuming that newLocation is an instance of CLLocation. It's using two different bases, but I would assume the check is meant to test whether some location information is less than 60 seconds old. Both should be either timeIntervalSince1970 or timeIntervalSinceReferenceDate (i.e., have the same basis). (Also we assume he meant [[NSDate date] dateWithTimeIntervalSinceReferenceDate] since the other would throw an exception)." – Jason Coco

Mustafa