aboutsummaryrefslogtreecommitdiffstats
path: root/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt
diff options
context:
space:
mode:
Diffstat (limited to 'kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt')
-rw-r--r--kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt15
1 files changed, 15 insertions, 0 deletions
diff --git a/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt b/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt
new file mode 100644
index 00000000..a5c83d32
--- /dev/null
+++ b/kotlinx-coroutines-core/jvm/test/scheduling/TestTimeSource.kt
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.coroutines.scheduling
+
+
+internal class TestTimeSource(var time: Long) : TimeSource() {
+
+ override fun nanoTime() = time
+
+ fun step(delta: Long = WORK_STEALING_TIME_RESOLUTION_NS) {
+ time += delta
+ }
+}