Duplicate timestamps in UWB (Nearby Interaction) updates.

Hello,

We are using NearbyInteraction to get the distance between an iPhone and Apple Watch. Overall it works pretty well, but we are noticing that it sometimes produces duplicate (or near duplicate) timestamps. Here is an example of the data produced (time is in seconds since scan start):

0: 1.882862
1: 1.88296
2: 1.981459
3: 1.981495
4: 2.080235
5: 2.080397

As you can see there's a pattern where two updates have very similar timestamps. This seems to only happen when using 2 U2 chips together. Is this an expected behavior? If so, why?

The timestamps are calculated using:

let bootTimeInterval = bootTime()
func bootTime() -> TimeInterval {
    let uptime = ProcessInfo.processInfo.systemUptime
    let nowTimeIntervalSince1970 = Date().timeIntervalSince1970
    return nowTimeIntervalSince1970 - uptime
}
// Then later on each NISession update...
let timestamp = bootTimeInterval + ProcessInfo.processInfo.systemUptime

The app produces unix timestamps but I have converted them to be relative to the start of the scan to be easier to read.

Note that bootTimeInterval is calculated once at the start of the app, so all timestamps produced on a UWB update should be using the same clock.

Things I've confirmed:

  • The NISession is only able to connect to one device, so it is not coming from a different device.

Any feedback is appreciated, thank you.

Duplicate timestamps in UWB (Nearby Interaction) updates.
 
 
Q