Skip to content

Read epoch instants from EpochClock instead of CurrentDateProvider #6583

Open

Description

@runningcode

Several internal call sites use CurrentDateProvider only to read the current epoch time. options.getEpochClock() gives the same value. Moving them now changes nothing that is sent, and it shrinks what v9 has to change when it removes ICurrentDateProvider (#6506).

Call sites

  • AnrV2Integration and TombstoneIntegration pass the provider to ApplicationExitInfoHistoryDispatcher, which computes the 90-day cutoff for ApplicationExitInfo timestamps.
  • MemoryLimiterIntegration passes it to the same dispatcher.
  • SentryOkHttpInterceptor and SentryOkHttpEvent stamp HTTP_START_TIMESTAMP and HTTP_END_TIMESTAMP for replay network details.

Each one compares against or sends an epoch instant, so each has to stay on the wall clock. EpochClock is the wall clock. On Android it reads System.currentTimeMillis(). On Java 9+ it reads Instant, which gives the same millisecond.

None of this is public API. The integrations' constructors that take an ICurrentDateProvider are package-private and only used by tests.

Out of scope

Done when

  • None of the call sites above references CurrentDateProvider.
  • Tests inject a fake EpochClock.
  • No .api diff and no changelog entry, because nothing users can see changes.
Agent notes

Verified on main at 812682636b (2026-11-12).

  • AnrV2Integration.java:56 (default ctor), :59-60 (test ctor), :91 (dispatcher).
  • TombstoneIntegration.java:60, :63-64, :100.
  • MemoryLimiterIntegration.java:96, :100-102, :152.
  • ApplicationExitInfoHistoryDispatcher.java:60 (ctor param), :66 (threshold = now - NINETY_DAYS_THRESHOLD).
  • sentry-okhttp: SentryOkHttpEvent.kt:54, :180; SentryOkHttpInterceptor.kt:112 (breadcrumb start), :272.
  • EpochClock.now() returns a Timestamp; convert with TimeUnit.NANOSECONDS.toMillis(now.epochNanos()), the way LifecycleWatcher does on 9.x.x.
  • Reduces the @SuppressWarnings("deprecation") count for the deprecation ticket in this project, so land this first if both are in flight.

Activity

  1. linear-code commented on Nov 12, 2026

    @linear-code
  2. self-assigned this
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions