ref(core): Avoid side-effect of & streamline timestampInSeconds method#16890
Merged
ref(core): Avoid side-effect of & streamline timestampInSeconds method#16890
timestampInSeconds method#16890Conversation
There was a problem hiding this comment.
Bug: Performance API Time Origin Handling Error
The condition !performance.timeOrigin incorrectly treats a valid performance.timeOrigin value of 0 (representing the Unix epoch) as missing. This causes an unnecessary fallback to the less accurate dateTimestampInSeconds instead of utilizing the more precise Performance API. The previous check performance.timeOrigin == undefined correctly distinguished between missing and valid 0 values.
packages/core/src/utils/time.ts#L36-L37
sentry-javascript/packages/core/src/utils/time.ts
Lines 36 to 37 in 72a09fe
Was this report helpful? Give feedback by reacting with 👍 or 👎
Contributor
size-limit report 📦
|
timfish
approved these changes
Jul 10, 2025
antonis
added a commit
to getsentry/sentry-react-native
that referenced
this pull request
Aug 28, 2025
10 tasks
antonis
added a commit
to getsentry/sentry-react-native
that referenced
this pull request
Aug 28, 2025
* chore(ci): v7: Handle GH runner image deprecations * chore(deps): v7: update Android SDK to v8.20.0 * Adds changelog * Set specific xcode version for expo (see expo/expo#36830) * Bump Javascript SDK to 9.44.2 * Bump Javascript SDK to 10.4.0 and rename deprecated base client getsentry/sentry-javascript#17071 * Renames logger getsentry/sentry-javascript#16901 * Bump Javascript SDK to 10.7.0 * Adds changelog * Sets skipLibCheck to true in ts3.8 typecheck * Fixes fake timers jest issue after getsentry/sentry-javascript#16890 * Fixes lint issue * Apply suggestions from code review Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com> * Update yarn.lock --------- Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #16846
This rewrites
timestampInSecondsto avoid side effects.As a part of this, I also streamlined this a bit to remove special handling for missing
timeOrigin. If that is missing, we just fall back to usingdateTimestampInSeconds, instead of doing some custom handling oftimeOrigin- IMHO that should not be any less accurate, as otherwise we are currently mixingperformance.nowwithDate.now()which is likely not necessarily accurate either.