clock accuracy on iphone - iphone

In dealing with Android devices, I've observed plenty of inaccurate - and sometimes downright
wrong - system times.
I do not have access to many iPhones, but those I have seen have accurate times.
Is the time GMT on iPhones always accurate? (E.g. speculate you could use network time or build-in ntp or use the time in GPS fixes to adjust drift; all this could occur in the platform so that applications are insulated from trying to determine the time themselves)
If the iPhone time functions do not represent a reasonable real-world time, how would you determine the real-world time?

Many phones are able to get the local time from the network provider - although I've seen that be a few seconds off here and there.
If you really need to be accurate - you can get your time from an NTP server and correct for local time using the phone's locale.

Related

How to measure close distance between two iphone devices using bluetooth?

Can you work out if another iphone is say ~5 horizontal meters away?
This question has been asked here almost identically but a decade is a long time in tech. I have no interest in direction.
How to measure distance between two iphone devices using bluetooth?
Current solution attempts
GPS - This is too inaccurate for <10m
Bluetooth - iBeacon a potential solution for iphones. Similarly, may be too inaccurate due to BT signal interference. At least as SO claims 5 years ago. (How to measure the distance between an iPhone acting like an iBeacon and an Android device)
Have we made any progress here?
There have been no significant changes in the past 5 years. I wrote a blog post with a deep dive into the current state as of 2020. Mobile phones in 2020 have newer bluetooth chipsets than in 2015, and may support Bluetooth 5, but there are no significant new capabilities that improve the reliability distance estimates. Indeed, there are no new proximity sensors on iOS and Android phones (other than NFC, which only measures proximity of a few centimeters away), so it is inappropriate for this use case. What's more, 5 years has made things worse by adding fragmentation, especially on the iOS side. Back in 2015, there were only a few Apple handset variants in common circulation. Now there are over a dozen.
To recap the current state of affairs that is mostly unchanged: you can use one phone to transmit over BLE and another to measure the signal strength and estimate distance. For known transmitters and approximately line of sight conditions (e.g. phones are not in a pocket or purse) measuring whether two phones are 5 meters apart is possible with perhaps a 60 percent confidence interval. Where this falls apart is with three important variables:
Phones and especially Android phones are quite fragmented. Transmitter power and receiver sensitivity are quite unpredictable between models and have a large variance. Apple has much less variance between models, but you still see differences that noticeably affect results.
People often put phones in a case, a purse or a pocket. This throws things off considerably further.
When clear line of sight conditions are not present, results are unreliable as you have said.
Bluetooth 5.1 does offer Angle of Arrival and other features that may improve this, but as of October 2020, neither Android 11 nor iOS 14 support any of these features, making the features unusable with almost any mobile phone.

Obstetrician needs help! How to exactly synchronize system time between iPhone and Windows 10 Laptop

We are trying to develop a low-cost ultrasound device that can be used by inexperienced operators for health care in developing countries. We have created a low-profile optical tracking system that connects to the ultrasound probe. It outputs positional data from both the binocular camera and an on-board 9-axis IMU. The ultrasound pictures are collected on an iPhone at a frame rate of 60 per second and are time stamped to the millisecond based on the iPhone system time. The optical tracker collects positional data onto a Windows 10 laptop. We need to exactly synchronize the system time of the 2 devices (iPhone, laptop) at least to 1/10 sec and preferably to the millisecond.
Is there a way to access the precise system time on the iPhone and synchronize this with the laptop?
Full disclosure: I am an obstetrician and not an engineer. But I’m not satisfied with the story I’m getting from the developers about this. It must be possible.
We've tried pointing the laptop to the same internet clock as the iPhone, but the sync is not good enough. Maybe because of wifi latency?

High accuracy clock source for Orange Pi

We're trying to have time-keeping as close to real-time as possible. Since our network doesn't support PTP, I'm using NTP. We have an NTP-server with GPS at disposal, and we're syncing about every minutes.
Though we still experience a little drift - of course. But some of our hardware drifts more than others. The best drifts about 1/10th of a ms where as other drift as much as 1.5ms.
We would like to hit around 0.25ms 90% of the time.
Does anyone know if it is possible to change the crystal on the board to a more accurate crystal, or have an idea how to make the clock drift less?
Best regards.

Controlling GPS sampling on iPhone

I have two questions regarding GPS sampling on iPhone:
1.Is it possible to use CLLocationManager (or any other method) for location readings based on GPS alone without WiFi or Cellular network affecting it?
2.Given a stationary device, is it possible to control the sampling rate? Can I use CLLocationManager to get nonstop location readings from GPS in nanoseconds resolution? If not, what's the best resolution I can get?
regarding number 1, apparently, you cannot directly control gps data. having said that: if you have speed > 0 AND high accuracy, then you can infer that your data has a high probability of having come from a gps reading.
as far as i know, gps fixing is not measured in nanoseconds, but rather in seconds. what you mean exactly by resolution (reading frequency?) is a bit unclear. but, if it is frequency, most navigational software (google, for example) refreshes location every second or so.
hi frequency position updating is very costly in terms of storage cost (server side), query times (server side), battery use (iphone) and heats the phone up bigtime. i would be going in the opposite direction, especially for stationary devices (sending a heartbeat every 5 minutes or so is usually more than enough).
reference on CLLocationManager

How quickly can 2 iphones exchange information regarding tilt/position?

I was wondering what amount of time is required to convey information regarding the tilt and position (not gps) of one particular iphone to another. Could 2 iphones send and receive this information simultaneously? What about 3 iphones? I'm interested in an application that is able to simultaneously send and receive and make conditional decisions based on this information received all within a half a second-ish.
Any shot this is possible? If so, is bluetooth or wifi better?
Thanks a ton,
Jake
This is currently not possible without an intermediate server. (Without a jailbreak, which would make it possible, but extremely difficult)
I'm assuming your purpose is gaming, in which case, the latency associated with a trip to a server and back over a cellular data network, is likely to take too long for any satisfactory gaming experience. I don't believe it would be within half a second.
This will be possible via Bluetooth in the upcoming 3.0 iPhone software, but that is still under NDA, so you are not likely to be able to get any reliable performance numbers until it is released. If I were guessing, I would certainly guess that the latency associated with a direct Bluetooth connection would be FAR under half a second.
All you've got as an option right now is Wi-Fi or the Cell Network. If you use Bonjour over Wi-Fi, you'd have latencies in the milliseconds, but all the phones would have to be connected to the same access point. Take a look at the WiTap example.
It is definitely possible, you'd want to connect your peers over WiFi for best performance and reliability, but Bluetooth would be ok as long as your data packets were constrained to small sizes (< 1k). Check out this documentation and sample code to see how to access UIAccelerometer:
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIAccelerometer_Class/Reference/UIAccelerometer.html
http://developer.apple.com/iphone/library/samplecode/AccelerometerGraph/index.html#//apple_ref/doc/uid/DTS40007410
The trick is that the update frequency is controlled in part by the systems needs, so there may be a window (while the system is attempting to update device orientation) wherein your application receives no updates.