Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change duration usages to fix deprecation warnings #69

Merged
merged 2 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion temporal/src/commonTest/kotlin/TemporalFlowTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.time.Duration
import kotlin.time.ExperimentalTime
import kotlin.time.seconds

@ExperimentalTime
private val EPSILON = 5.seconds
private val EPSILON = Duration.seconds(5)

@ExperimentalTime
@AndroidIgnore("Cannot use Android classes BroadcastReceiver or IntentFilter.")
Expand Down
6 changes: 3 additions & 3 deletions temporal/src/commonTest/kotlin/TickerTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.time.Duration
import kotlin.time.ExperimentalTime
import kotlin.time.TimeSource
import kotlin.time.seconds

private const val NUM_TICKS = 5

private const val ERROR_TOO_FAST = "Flow collected too quickly."
private const val ERROR_TOO_SLOW = "Flow collected too slowly."

@ExperimentalTime
private val TIME_TICK = 0.5.seconds
private val TIME_TICK = Duration.seconds(0.5)

@ExperimentalTime
private val TIME_EXPECTED = TIME_TICK * (NUM_TICKS - 1)

@ExperimentalTime
private val TIME_EPSILON = 0.125.seconds
private val TIME_EPSILON = Duration.seconds(0.125)

@ExperimentalTime
class TickerTests {
Expand Down
6 changes: 3 additions & 3 deletions temporal/src/jsMain/kotlin/TickerTemporalFlow.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.juul.tuulbox.temporal

import kotlinx.coroutines.flow.Flow
import kotlin.time.Duration
import kotlin.time.ExperimentalTime
import kotlin.time.minutes

@ExperimentalTime
internal actual inline fun <T> inlineTemporalFlow(
crossinline factory: () -> T
): Flow<T> = ticker(1.minutes, factory)
): Flow<T> = ticker(Duration.minutes(1), factory)

@ExperimentalTime
public actual fun <T> temporalFlow(
factory: () -> T
): Flow<T> = ticker(1.minutes, factory)
): Flow<T> = ticker(Duration.minutes(1), factory)
6 changes: 3 additions & 3 deletions temporal/src/jvmMain/kotlin/TickerTemporalFlow.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.juul.tuulbox.temporal

import kotlinx.coroutines.flow.Flow
import kotlin.time.minutes
import kotlin.time.Duration

internal actual inline fun <T> inlineTemporalFlow(
crossinline factory: () -> T
): Flow<T> = ticker(1.minutes, factory)
): Flow<T> = ticker(Duration.minutes(1), factory)

public actual fun <T> temporalFlow(
factory: () -> T
): Flow<T> = ticker(1.minutes, factory)
): Flow<T> = ticker(Duration.minutes(1), factory)