Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5974149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:54:08+00:00 2026-05-22T20:54:08+00:00

In More iPhone Programming book, the author does: – (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation

  • 0

In More iPhone Programming book, the author does:

    - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
        if ([newLocation.timestamp timeIntervalSince1970] < [NSDate timeIntervalSinceReferenceDate] - 60)
        locationCoordinate = newLocation.coordinate;
return;
    ...

To make sure the data was taken in the last minute. Two questions:

1) What is the if statement doing. It seems like on the left hand side, you are getting the time difference in seconds between when this method fires and the 1970 date. Then on the right hand side, you get the difference in seconds between the 2001 date and now minus 60 seconds. So to me, the if statement would never be valid since the data on the left is always going to be a greater amount of seconds. Or am I understanding it wrong?

2) What does return in a void function do? Is that considered good coding here? Thx.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:54:09+00:00Added an answer on May 22, 2026 at 8:54 pm

    I don’t know what is going on here, its confusing statement, I have use something like this

        - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
            NSDate* eventDate = newLocation.timestamp;
            NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
            if( abs(howRecent) > 1.0 )
                   return;
            ////process your event here
    }
    

    It is right to put return in void method, as I don’t want to execute the statement next for some conditions..the same code can be written as

        - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
            NSDate* eventDate = newLocation.timestamp;
            NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
            if( abs(howRecent) < 1.0 ){
                     ///process your event
                   }
    }
    

    it just depends upon your need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing an iPhone application that uses a UITabBarController with more than 5
I finished learning the Big Nerd Ranch Guide to iPhone programming but now I
Well, I've started with iPod/iPhone programming using Head First iPhone Development (O'reilly) and I'm
From the iPhone Programming Guide When creating files or writing out file data, keep
I am learning iPhone programming by reviewing the iPhone Recipes sample application. I am
I'm currently reading Aaron Hillegass' book Cocoa Programming for Mac OS X as it
These seem like a great combination--I'd expect to see more on at least GWT/iPhone
I want to learn how to use core-animation for the iPhone in a more
When programming for the iPhone, when is it best to use CoreAnimation over another
I am new to programming for the iPhone and this will be my first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.