Skip to content

ref(time): Read the epoch time from EpochClock (JAVA-836) - #6588

Merged
runningcode merged 1 commit into
mainfrom
no/java-836-epoch-clock-callers
Nov 17, 2026
Merged

runningcode merged 1 commit into
mainfrom
no/java-836-epoch-clock-callers

Conversation

@runningcode

@runningcode runningcode commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

This PR just removes uses of CurrentDateProvider and replaces them with options.getEpochClock(). There's no value or clock changing.

Like so:

- CurrentDateProvider.getInstance().getCurrentTimeMillis()
+ options.getEpochClock().now().epochMillis()   // new helper on Timestamp

Why the values stay the same: getEpochClock() is always SystemEpochClock, which reads System.currentTimeMillis() on Android and Instant.now() on Java 9+. Both read the same system clock as CurrentDateProvider.

Public API: unchanged. The removed constructors were package-private. The only .api change is Timestamp.epochMillis(), and Timestamp is @ApiStatus.Internal.

💡 Motivation and Context

Fewer callers to change when v9 removes ICurrentDateProvider (JAVA-827), and fewer @SuppressWarnings("deprecation") once JAVA-839 deprecates it.

💚 How did you test it?

New TimestampTest case for epochMillis() truncation. The exit-info integration tests and sentry-okhttp tests already used the real clock and pass unchanged.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

JAVA-839 deprecates CurrentDateProvider.getInstance() and the rest of the legacy clock API.

#skip-changelog

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Nov 12, 2026

Copy link
Copy Markdown

JAVA-836

@sentry

sentry Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.64.0 (1) release

⚙️ sentry-android Build Distribution Settings

The ApplicationExitInfo cutoff and okhttp's replay breadcrumb timestamps
only need the current epoch time, which options.getEpochClock() gives.
Moving them off CurrentDateProvider changes no values, and leaves fewer
callers for v9 to touch when it removes ICurrentDateProvider.

The three exit-info integrations no longer take a date provider: the
dispatcher reads the clock from the options it already has.

Timestamp.epochMillis() converts for the call sites that need millis.

Fixes JAVA-836

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/java-836-epoch-clock-callers branch from 179af89 to 87e190c Compare November 16, 2026 13:56
@runningcode
runningcode marked this pull request as ready for review November 16, 2026 13:59
@runningcode
runningcode requested review from a team and adinauer as code owners November 16, 2026 13:59
@runningcode
runningcode requested review from markushi and romtsn and removed request for a team November 16, 2026 13:59
@github-actions github-actions Bot added the risk: low PR risk score: low label Nov 16, 2026
@runningcode
runningcode merged commit 1943d47 into main Nov 17, 2026
56 checks passed
@runningcode
runningcode deleted the no/java-836-epoch-clock-callers branch November 17, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read epoch instants from EpochClock instead of CurrentDateProvider

2 participants