0

Disclaimer: This a very theoretical idea that I'm experimenting with and I get that there are hard limits to CPU hardware and physics; this is more about seeing how far I can get.

The Question: How do you measure the difference in Nanoseconds between the host device and the standard time the device would be synced to.

According to this article you experience "Nanoseconds" of Time Dilation relative to something like sea level every time you fly on an airplane.

The idea is that you have the app before you get on a plane and when you land, you get a notification saying: "You've Time Traveled XXX Nanoseconds!"

I assume that any standard time duration utilities in Swift are subject to the system clock and automatically synced to an NTP Server.

I'm wondering if there's a way to measure a time duration separate from any time that's synced to a remote server or carrier.

If not, can this be accomplished with lower-level language like Rust?

I've seen iOS APIs that can parse Nanoseconds I just can't find any resources on other factors you would have mitigate to actually measure Time Dilation.

Sam Carlton
  • 1,190
  • 1
  • 17
  • 18
  • 3
    You’re better off calculating the time dialarion based off the integration of the user’s speed, rather than trying to measure it. I would posits the actual amount of time dialation will be way way way lower than the precision of the system clock or NTP. – Alexander Jan 04 '23 at 22:02
  • @Alexander That was another option I saw, but I also read that, for satellites, gravity/distance from Earth can have a more dominant effect than speed so I wasn't sure about planes. Is there a good formula for calculating this for a phone on a plane? – Sam Carlton Jan 04 '23 at 22:31
  • 1
    I'm not sure which effect would "win out". Both seem small (a plane's speed relative to the speed of light would be tiny, and thus the Lorentz factor would be tiny, but so would the difference in gravitational force on a plane vs on the ground). You'd need to calculate both and compare (and you can account for both effects if you want, you're not forced to choose one or the other). See https://calculators.io/time-dilation/ – Alexander Jan 04 '23 at 23:20
  • I would use [systemUpTime](https://developer.apple.com/documentation/foundation/processinfo/1414553-systemuptime) associated with now time and compare the difference of the 2 values. As the system time will updated but systemUpTime is only based on computer clock this may do the trick. – Ptit Xav Jan 04 '23 at 23:47
  • @PtitXav That's an interesting idea. Is there a way to test in Xcode to verify that systemUpTime ignore any NTP Server? – Sam Carlton Jan 05 '23 at 01:15
  • @Alexander I suppose any factor can almost never change the output more than one nanosecond could be ignored. – Sam Carlton Jan 05 '23 at 01:17

0 Answers0