The iPhone time goes backwards: a time warp maybe?

I’m developing an iPhone application which logs GPS data in a SQLite DB, including their timestamps.
When I’m running the application while I’m stationary, the timestamps are exactly what you’d expect, i.e., they matches the actual time shown by a wall clock, and sequential samples have increasing times.
However, when I run the application in a moving car, I notice that every 5-10 minutes or so the timestamp jumps back in time, sometimes by as much as 30 seconds.
For example, I might have a GPS reading with a timestamp of, say, today at 10:10:30, and the next GPS reading would have a timestamp of 10:10:01. After this happens, subsequent samples are well behaved (time is increasing), until after another 5-10 minutes when the time resets back again.
To check whether this problem is only related to the GPS, I started writing in the SQLite DB also the actual time [NSDate date] in which the location manager reports a new point. This time almost equals the GPS sample’s timestamp (within a few mS), and is also subject to the same occasional reset back of 10-30 seconds.
Has anyone seen this? Could it be a result of synching the iPhone time to that of cells along the way? If so, aren’t cells supposed to be synchronized to an atomic clock? If indeed it’s the time difference between cells, why wouldn’t the iPhone sync with the GPS time, which is atomic?
Does anyone know how to solve this, i.e., having monotonically increasing timestamps?

Thanks a lot Learning Annex Certified, that solved my problem.
Indeed machabsolutetime() is available on the iPhone, and seems to be the only reliable way to tell the time difference between two subsequent GPS readings. One should not reply on the samples’ timestamps, because from time to time subsequent timestamps go back in time as described in my first post above.
Caveat: the timestamp provided by the Location Manager is supposed to be the exact time in which the sample was taken. When one uses machabsolutetime() when a new point is available, there’s a small delay between the sample and the call of locationManager:didUpdateToLocation:fromLocation:, but hopefully the variance in the delay is small so the delta time between two samples is accurate.
Now, if only machabsolutetime() would have been available on Win98.

Similar Messages

  • HT1923 I am trying to uninstall itunes and at the point where i try to remove apple mobile device support it never completes and the timer goes backwards?

    I am trying to uninstall itunes and at thepiont where I try to remove apple mobile device support it never completes the timer goes backwards?

    First try a repair install of Apple Mobile Device Support. If that goes through successfully, see if you can now uninstall Apple Mobile Device Support.
    If the Repair install doesn't help, try using the fixit from the following Microsoft document to remove Apple Mobile Device Support:
    Fix problems with programs that can't be installed or uninstalled

  • When I tap on my Safari app. the iphone screen goes to a black blank screen. It has some stuff at the top like verizon 3g the time battery life. Whats wrong with it? Thats the only sceen doing it.

    When I tap on my Safari App. the Iphone screen goes to black blank screen. No other App. dose it
    . it started doing it right after I tapped on a screen that was all light blue with a circle with an arrow pointing towards the rigth hand side of screen. i had just been using the safari app search engine when this happen. How do I get the internet back.

    Reset the PRAM
    Reinstall the operating system from the dvd (you will not loose your data)

  • Can the iphone 5s display two clocks/time zones on my lock screen?

    Can the iphone 5s display two clocks/time zones on my lock screen?

    Sorry, no.
    If you'd like to see this as a feature, tell Apple:
    http://www.apple.com/feedback/iphone.html

  • TS1369 i have a screen with the apple logo on it and a bar underneath it. it has been this way for about an hour now. what does this mean and is there a way to reset the iphone without going into the store? it isnt showing in my computer or on the itunes

    i have a screen with the apple logo on it and a bar underneath it. it has been this way for about an hour now. what does this mean and is there a way to reset the iphone without going into the store? it isnt showing in my computer or on the itunes page.

    Try:
    - iOS: Not responding or does not turn on
    - If not successful and you can't fully turn the iPod fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.

  • When is the iPhone 5 going to be available in australia

    When is the iPhone 5 going to be available in australia?
    And when is Apple going to start taking pre-orders?

    No such device even exists... so this non-existent devices availablility in any country is impossible to determine.

  • Is the iPhone 5 going to be recalled for any reason?

    My friend keeps saying the iPhone 5 will be recalled for bunch of different season, is the iPhone 5 going to be recalled for any sort of reason?

    There is no way to foretell the future howver, if this is the same friend who told you that the world is going to end on December, 21, 2112, you shouldn't believe him.

  • When 'll The iPhone 5 Going To Be Released..? Want To Buy New iPhone. But Some Of Friends Suggesting To Wait For New One (iPhone 5)..

    When 'll The iPhone 5 Going To Be Released..? Want To Buy New iPhone. But Some Of Friends Suggesting To Wait For New One (iPhone 5)..

    There has been no announcement about any new iphone.
    From the terms of use of this forum:
    " do not add Submissions about nontechnical topics, including:
    Speculations or rumors about unannounced products."

  • Is there any way to match the dock and USB to the iphone it goes with?

    We have several iphones in our household.  An iphone 3, two iphone 3S and two iphone 4S.  Our teenage daughter keeps snatching everyone's charger and then claims innocence.  Funny thing, everyone's chargers are all gone and she's the only one who has one left.  We've never caught her red-handed, but we know without a doubt she's the little thief in the house.  Is there any way to match the dock and USB to the iphone it goes with? 

    A charger is only connectors plastic and rubber you Can MAKE one yourself with wires so no memories

  • When is the iphone map going work with the newest IOS

    Whe is the iphone map going work with the newest IOS?

    Sorry. This question doesn't make sense. It works just fine for me right now. Maybe you'd like to explain what your problem is...

  • When is the iphone 5s going to be out of backorder

    Whn is the iphone 5s going to be out of backorder

    I just called my phone company (Rogers) with the same question and they told me that they should send them out in about two weeks. Plus 3 to 5 business days for UPS to actually deliver. Plus I ordered my phone a week and a half ago, so the total duration of this transaction is more than a month, which is ridiculous.

  • When is the Iphone 5s going to be released unlocked for overseas?

    When is the iphone 5s going to be released unlocked for overseas?

    We are all just users like yourself so no one here  would know since Apple has not made any announcement.
    BTW this is the iPod touch forum

  • When is the iphone 5 going to be sold unlocked?

    I am wonderin when is the iphone 5 going to be available to be sold unlocked just as the iphone 4s?

    Whenever Apple decides to do so. As users here we don't know Apple's future plans.

  • Is the iPhone 4 going to be able to AirPlay mirroring when we get the ios5 update

    Is the iPhone 4 going to be able to have the capability to AirPlay mirroring when the ios5 update is available

    Only iOS devices with A5 processors will support Airplay Mirroring.  So it WILL work on the iPhone 4S and iPad2  which are equipped with an A5.

  • Applet timer going backwards.

    Does any know how to put a timer in a applet to count backwards. There is a good few
    swing clocks there alright, but i just want a normal handy applet that just goes backwards.
    thanks for any help,
    Brian

    import java.awt.*;
    import java.math.*;
    import java.util.*;
    import java.text.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class Timer extends JFrame
         JButton start = new JButton("Start");
         JButton stop  = new JButton("Stop");
         JLabel  time  = new JLabel("");
         javax.swing.Timer timer;
         SimpleDateFormat  timef = new SimpleDateFormat("HH:mm:ss");
         long startT,stopT;
    public Timer()
         super("Timer");
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         setBounds(10,10,400,200);
         getContentPane().setLayout(null);
         start.setBounds(10,30,100,24);
         start.setBackground(Color.green);
         stop.setBounds(10,60,100,24);
         stop.setBackground(Color.red);
         start.addActionListener(new ActionListener()
         {     public void actionPerformed( ActionEvent e )
                   startT = System.currentTimeMillis();
                   timer.start();
         stop.addActionListener(new ActionListener()
         {     public void actionPerformed( ActionEvent e )
                   timer.stop();
         time.setBounds(150,30,100,24);
         time.setOpaque(true);
         time.setBackground(Color.pink);
         getContentPane().add(stop);
         getContentPane().add(start);
         getContentPane().add(time);
         timer = new javax.swing.Timer(1000, new ActionListener()
              public void actionPerformed(ActionEvent e)
                   stopT = System.currentTimeMillis();
                   time.setText("-"+timef.format(new Date(stopT-startT)));
         setVisible(true);
    public static void main (String[] args) 
         UIManager.put("Label.font" ,new Font("Times New Roman",0,23));
         UIManager.put("Button.font",new Font("Arial",1,21));
         new Timer();

Maybe you are looking for

  • URGENT HELP NEEDED FOR TimeStamp

    Urgent Millisecond Question.... I have the Java Code which used to work well in Oracle 8 and Sybase .. When I am using it with Oracle 9.2 it creating a problem... The code is final public JDatetime getJDatetime(int columnIndex) throws SQLException {

  • Link to query Form and auto-execute

    What is the secret after creating a link from a report for example, to not only pass the link parameter to a query form, but to cause the form to execute the query. Currently my query form shows the passed parameter but doesn't auto-execute..

  • Problem in creating Function Module

    Hi,   while creating a function (Z_SPELL_AMOUNT_INDIA) one error is coming . the error  <b>'SPELL not declared</b> ' is coming. already the Function module is running correctly in different client(another client's place) i am just download the Functi

  • Error in Query View Saving -The standard transport system is active.You can

    Hi, I have a query in Dev system which is moved to production and i am able to edit the query in dev.But my problem is when i tried to create a view on that query and save the view, it is throwing me a error "The standard transport system is active.Y

  • ADF deploy Error

    Hi people.. i am using a Tomcat 6 web app and i am getting this error when trying to deploy an adf components 11 web app. 25-jun-2010 15:21:14 org.apache.catalina.core.StandardContext listenerStart GRAVE: Exception sending init context to instance ev