Repository navigation
[board] Measure session, view and timed event durations on a monotonic clock - #624
Draft
arifBurakDemiray wants to merge 1 commit into
Draft
arifBurakDemiray wants to merge 1 commit into
arifBurakDemiray wants to merge 1 commit into
Conversation
…lock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dependency security scanScanned 569 resolved dependencies — 343 buildscript, 14 published, 212 sample.
Below the HIGH threshold, but ours to upgrade (1)
Waived via allowlist (2)
95 further finding(s) in Gradle plugin internals are reported in the job summary and the Result: passed |
This branch has not been deployed
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.
Board card C-110 (part 1 of 3 of C-108, Android first as the reference for iOS and Web): Session/view/event durations use wall-clock differences on Android, iOS and Web; C++ fixed this on 10-17 (android)
Source: Countly/countly-sdk-cpp#161, which moved session, view and timed event durations to
std::chrono::steady_clockand kept request timestamps on the system clock.What breaks without it
Durations are differences of two
System.currentTimeMillis()readings. When the device clock moves between the two (manual change, NTP or carrier time sync, time zone travel with auto time), a backward change gives a zero or negativesession_duration, viewduror timed eventdur, and a forward change inflates them. Reasoned from code, not reproduced.What changed
UtilsTime.monotonicTimeMs()returnsSystemClock.elapsedRealtime()(counts deep sleep, unaffected by clock changes);monotonicTimeSeconds()is its whole-second form.prevSessionDurationStartTime_androundedSecondsSinceLastSessionDurationUpdate()use the monotonic clock. Thehalt()sentinel of0still works.viewStartTimeSecondsis set and read on the monotonic clock, still in whole seconds, still0for a paused view.startEventstores the monotonic start in a new package-privateEvent.monotonicStartMs(not serialized, not inequals), andendEventmeasures the duration from it. The event'stimestamp,houranddowstill come from the start's wall-clock instant.CountlyTests.testRoundedSecondsSinceLastSessionDurationUpdatebuilds its start values from the monotonic clock; a test comment inModuleViewsTestsnames the new call.## XX.XX.XX.Not verified
:sdk:compileDebugJavaWithJavacand:sdk:compileDebugAndroidTestJavaWithJavacpass. The instrumented tests were not run: the emulator would not boot on the worker machine (not enough disk).viewStartTimeSeconds == 0). Not handled, as it cannot happen in practice.🤖 Generated with Claude Code