diff --git a/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/AnalyticsExtensions.kt b/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/AnalyticsExtensions.kt index 1941cdd6..b1826652 100644 --- a/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/AnalyticsExtensions.kt +++ b/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/AnalyticsExtensions.kt @@ -9,9 +9,10 @@ */ package template.core.base.analytics -import kotlinx.datetime.Clock +import kotlin.time.Clock import kotlin.time.Duration import kotlin.time.DurationUnit +import kotlin.time.ExperimentalTime /** * Extension functions for enhanced analytics functionality @@ -115,8 +116,10 @@ class TimedEvent internal constructor( private val eventType: String, private val baseParams: List, ) { + @OptIn(ExperimentalTime::class) private val startTime = Clock.System.now().toEpochMilliseconds() + @OptIn(ExperimentalTime::class) fun complete(additionalParams: Map = emptyMap()) { val duration = Clock.System.now().toEpochMilliseconds() - startTime val params = baseParams + @@ -137,6 +140,7 @@ fun AnalyticsHelper.startTiming(eventType: String, vararg params: Pair AnalyticsHelper.timeExecution( eventType: String, vararg params: Pair, diff --git a/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/PerformanceTracker.kt b/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/PerformanceTracker.kt index 535e1088..62e1169f 100644 --- a/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/PerformanceTracker.kt +++ b/core-base/analytics/src/commonMain/kotlin/template/core/base/analytics/PerformanceTracker.kt @@ -9,7 +9,8 @@ */ package template.core.base.analytics -import kotlinx.datetime.Clock +import kotlin.time.Clock +import kotlin.time.ExperimentalTime /** Performance tracking utilities for analytics */ @@ -262,6 +263,7 @@ fun AnalyticsHelper.performanceTracker( /** Create an app lifecycle tracker */ fun AnalyticsHelper.lifecycleTracker(): AppLifecycleTracker = AppLifecycleTracker(this) +@OptIn(ExperimentalTime::class) private val currentTime = Clock.System.now().toEpochMilliseconds() /** Quick performance timing for suspend functions */