1

For my fitness tracking app on iOS I need to have timestamps that are accurate to a thousandth of a second. I'm not sure if this is a bug or not but for some reason the timestamp I get back with each location update starts off fine giving me fractions of a second that are all different, but once it has a good lock on the GPS each timestamp then has the same fractions of a second. I'm not sure if something has changed with iOS because this was working fine until recently. The locations are also being filtered by horizontal accuracy of 20 meters or under.

Here's an example of timestamps using the format yyyy-MM-dd HH:mm:ss.SSSSSS

Timestamp: 2019-06-26 12:07:21.168000
Timestamp: 2019-06-26 12:07:22.118000
Timestamp: 2019-06-26 12:07:23.068000
Timestamp: 2019-06-26 12:07:25.000000
Timestamp: 2019-06-26 12:07:26.000000
Timestamp: 2019-06-26 12:07:28.000000
Timestamp: 2019-06-26 12:07:31.000000
Timestamp: 2019-06-26 12:07:33.000000
Timestamp: 2019-06-26 12:07:35.000000
Timestamp: 2019-06-26 12:07:38.000000
Timestamp: 2019-06-26 12:07:39.000000
Timestamp: 2019-06-26 12:07:41.000000
Timestamp: 2019-06-26 12:07:43.000000
Timestamp: 2019-06-26 12:07:52.000000

Anyone have any idea what is going on?

Marwen Doukh
  • 1,946
  • 17
  • 26
Neil Faulkner
  • 526
  • 1
  • 4
  • 22
  • Hi did you get anywhere with this? I have the same problem. For me... the absolute time difference between the first and last points seems way off / far too high. Showing we need those fraction seconds. – MagicFlow May 25 '20 at 22:24
  • No I did not unfortunately, best bet is file a report with apple and hope they fix it in an update. – Neil Faulkner May 26 '20 at 07:49

1 Answers1

0

The format that you use to print the date has nothing to do with precision. The class CLLocation is just data type which can hold timeStamp documented as "The time at which this location was determined".

There are different systems that can create objects of CLLocation and can insert any timeStamp they want to. That can even include rounding. In your case you might as well be looking at 2 different systems in background providing you location data. They may use different ways of determining time stamp. Or maybe it is one system which at some point starts triggering only when a new second begins and uses that as a time stamp.

In any case you need to check the system which is creating instances of CLLocation if it says anything about guaranteeing you time stamp precision. I would not assume this to be very precise though. You will need to do a research if a system exists that can fulfill your requirement: "I need to have timestamps that are accurate to a thousandth".

Matic Oblak
  • 16,318
  • 3
  • 24
  • 43
  • Yes Im aware about the date format, but I included it to show the format I'm displaying each timestamp. Ok and how would I determine which system is inserting the timestamp? The CLLocationManager creates the CLLocation and then the delegate function is called, which is where I'm checking the timestamp. – Neil Faulkner Jun 26 '19 at 12:13
  • @NeilFaulkner then in your case you definitely need to start with location manager. Even searching for it with time stamp you can get to rather similar question as your own. Have you maybe checked this one: https://stackoverflow.com/a/41606688/526828 ? – Matic Oblak Jun 26 '19 at 12:16
  • Yes I have tried to change the CLLocationManager settings but nothing makes a difference and I also ignore the cached locations by checking the timestamp is under 10 seconds. – Neil Faulkner Jun 26 '19 at 12:23
  • @NeilFaulkner I don't see anywhere any mentioning of precision of time stamp in location manager. Perhaps you will need to find another tool that does guarantee you desired precision. I am not sure such a tool exists though. – Matic Oblak Jun 26 '19 at 12:26
  • Yeah.. its just strange it has been working fine for months but now it isn't... I only assume Apple changed something. – Neil Faulkner Jun 26 '19 at 12:31