Repository navigation
Commit aa53f2e
ref(time): Read the epoch directly instead of through SentryDateProvider (JAVA-572)
DateProviderEpochClock took its instant from options.getDateProvider(),
which meant allocating a SentryDate per call to read one long out of it --
and on Android that allocation also takes a System.nanoTime() reading that
an EpochClock never looks at, because a Timing measures on the
elapsed-real-time clock instead. The indirection bought compatibility with
a tick nothing here consumes.
SystemEpochClock reads the epoch itself, picking precision the way
SentryAutoDateProvider does: Instant.now() on JVM 9+, currentTimeMillis()
otherwise. Android is always the latter -- Instant is millisecond-granular
there whether or not the build desugars it. InstantEpochNanos is a class of
its own so the java.time reference is loaded only where it is used, the
same reason SentryInstantDate is kept separate.
The values are identical on every platform; the dependency is what changes.
setDateProvider no longer reaches the epoch clock, so tests override
getEpochClock() on SentryOptions, as SentryAndroidOptions already does for
getElapsedRealtimeClock().
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 1b7d36b commit aa53f2e
7 files changed
Lines changed: 114 additions & 94 deletions
File tree
- sentry
- api
- src
- main/java/io/sentry
- time
- test/java/io/sentry
- time
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7621 | 7621 | | |
7622 | 7622 | | |
7623 | 7623 | | |
| 7624 | + | |
| 7625 | + | |
| 7626 | + | |
| 7627 | + | |
| 7628 | + | |
| 7629 | + | |
7624 | 7630 | | |
7625 | 7631 | | |
7626 | 7632 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
529 | 530 | | |
530 | 531 | | |
531 | 532 | | |
532 | | - | |
| 533 | + | |
533 | 534 | | |
534 | 535 | | |
535 | 536 | | |
| |||
3069 | 3070 | | |
3070 | 3071 | | |
3071 | 3072 | | |
3072 | | - | |
3073 | | - | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
3074 | 3076 | | |
3075 | 3077 | | |
3076 | 3078 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
0 commit comments