getsentry / getsentry/sentry-cocoa
Use absolute time for tracing duration
- Dominant language
- Swift
- Stars
- 1.1k
- Forks
- 418
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 106
Description
### Description
Currently, our transactions and spans use NSDate, which is not a safe API for time-sensitive measurements because
the time can be changed in iOS settings or by the system when it recalibrates with a remote
source of truth. Instead, we could switch to absolute system timestamps as used by profiling.
[https://github.com/getsentry/sentry-cocoa/blob/eefdeedf0d7edd17ac03e89ab7a4da75f24bc1ff/Sources/Sentry/include/SentryTime.h#L10-L14]()
We could achieve this by internally keeping track of absolute timestamps and converting these to NSDate when finishing a transaction. We might also have to adjust span timestamps, as the system time could have changed during the lifetime of a transaction.
Contributor guide
Assessment
This issue has not been assessed yet.