Skip to content

Commit 2a326ef

Browse files
committed
Minor: replace posix abs with kotlin.math
Do not use kotlin.test API in production sources
1 parent 7f6312b commit 2a326ef

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

core/nativeMain/src/Instant.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ package kotlinx.datetime
1111
import kotlinx.cinterop.*
1212
import platform.posix.*
1313
import kotlin.math.*
14-
import kotlin.test.*
1514
import kotlin.time.*
1615

1716
public actual enum class DayOfWeek {
@@ -212,7 +211,7 @@ public actual class Instant internal constructor(actual val epochSeconds: Long,
212211
actual fun now(): Instant = memScoped {
213212
val timespecBuf = alloc<timespec>()
214213
val error = clock_gettime(CLOCK_REALTIME, timespecBuf.ptr)
215-
assertEquals(0, error)
214+
assert(error == 0)
216215
// according to https://en.cppreference.com/w/c/chrono/timespec,
217216
// tv_nsec in [0; 10^9), so no need to call [ofEpochSecond].
218217
val seconds = timespecBuf.tv_sec.convert<Long>()

core/nativeMain/src/TimeZone.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package kotlinx.datetime
1010

11+
import kotlin.math.abs
1112
import kotlinx.cinterop.*
1213
import platform.posix.*
1314
import kotlin.native.concurrent.*

core/nativeMain/src/Util.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
package kotlinx.datetime
99

10-
import platform.posix.*
10+
import kotlin.math.abs
1111

1212
/**
1313
* Calculates [a] * [b] / [c]. Returns a pair of the quotient and the remainder.

0 commit comments

Comments
 (0)