File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
libnavigation-util/src/main/java/com/mapbox/navigation/utils/internal
libnavui-voice/src/main/java/com/mapbox/navigation/ui/voice/api Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 11package com.mapbox.navigation.utils.internal
22
3+ import android.os.SystemClock
34import java.util.concurrent.TimeUnit
45
56interface Time {
7+
68 fun nanoTime (): Long
9+
710 fun millis (): Long
8- fun seconds (): Long
911
12+ fun seconds (): Long
1013 object SystemImpl : Time {
1114 override fun nanoTime (): Long = System .nanoTime()
1215
1316 override fun millis (): Long = System .currentTimeMillis()
1417
1518 override fun seconds (): Long = TimeUnit .MILLISECONDS .toSeconds(millis())
1619 }
20+
21+ object SystemClockImpl : Time {
22+ override fun nanoTime (): Long = SystemClock .elapsedRealtimeNanos()
23+
24+ override fun millis (): Long = SystemClock .elapsedRealtime()
25+
26+ override fun seconds (): Long = TimeUnit .MILLISECONDS .toSeconds(seconds())
27+ }
1728}
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class VoiceInstructionsPrefetcher internal constructor(
2626 private val timePercentageToTriggerAfter : Double ,
2727 private val nextVoiceInstructionsProvider : NextVoiceInstructionsProvider =
2828 TimeBasedNextVoiceInstructionsProvider (observableTime),
29- private val timeProvider : Time = Time .SystemImpl ,
29+ private val timeProvider : Time = Time .SystemClockImpl ,
3030) : MapboxNavigationObserver {
3131
3232 /* *
You can’t perform that action at this time.
0 commit comments