Fix ci import (#1932)

This commit is contained in:
Rajan Maurya 2025-09-11 01:56:30 +05:30 committed by GitHub
parent e76aa77063
commit 6a334c663e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -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<Param>,
) {
@OptIn(ExperimentalTime::class)
private val startTime = Clock.System.now().toEpochMilliseconds()
@OptIn(ExperimentalTime::class)
fun complete(additionalParams: Map<String, String> = emptyMap()) {
val duration = Clock.System.now().toEpochMilliseconds() - startTime
val params = baseParams +
@ -137,6 +140,7 @@ fun AnalyticsHelper.startTiming(eventType: String, vararg params: Pair<String, S
/**
* Time a block of code execution
*/
@OptIn(ExperimentalTime::class)
inline fun <T> AnalyticsHelper.timeExecution(
eventType: String,
vararg params: Pair<String, String>,

View File

@ -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 */