-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
162d768
commit 9c48437
Showing
5 changed files
with
81 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
connect/src/main/java/com/stripe/android/connect/util/AndroidClock.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.stripe.android.connect.util | ||
|
||
/** | ||
* [Clock] interface to be used to provide compatible `Clock` functionality, | ||
* and one day be replaced by `java.time.Clock` when all consumers support > SDK 26. | ||
* | ||
* Also useful for mocking in tests. | ||
*/ | ||
interface Clock { | ||
|
||
/** | ||
* Return the current system time in milliseconds | ||
*/ | ||
fun millis(): Long | ||
} | ||
|
||
/** | ||
* A [Clock] that depends on Android APIs. To be replaced by java.time.Clock when all consumers | ||
* support > SDK 26. | ||
*/ | ||
class AndroidClock : Clock { | ||
override fun millis(): Long = System.currentTimeMillis() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters