Skip to content

Commit e198569

Browse files
committed
Remove unused functions
1 parent b07ef03 commit e198569

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

core/commonJs/src/Instant.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package kotlinx.datetime
77

88
import kotlinx.datetime.format.*
99
import kotlinx.datetime.internal.JSJoda.Instant as jtInstant
10-
import kotlinx.datetime.internal.JSJoda.OffsetDateTime as jtOffsetDateTime
1110
import kotlinx.datetime.internal.JSJoda.Duration as jtDuration
1211
import kotlinx.datetime.internal.JSJoda.Clock as jtClock
1312
import kotlinx.datetime.internal.JSJoda.ChronoUnit as jtChronoUnit
@@ -84,17 +83,6 @@ public actual class Instant internal constructor(internal val value: jtInstant)
8483
@Deprecated("This overload is only kept for binary compatibility", level = DeprecationLevel.HIDDEN)
8584
public fun parse(isoString: String): Instant = parse(input = isoString)
8685

87-
/** A workaround for the string representations of Instant that have an offset of the form
88-
* "+XX" not being recognized by [jtOffsetDateTime.parse], while "+XX:XX" work fine. */
89-
private fun fixOffsetRepresentation(isoString: String): String {
90-
val time = isoString.indexOf('T', ignoreCase = true)
91-
if (time == -1) return isoString // the string is malformed
92-
val offset = isoString.indexOfLast { c -> c == '+' || c == '-' }
93-
if (offset < time) return isoString // the offset is 'Z' and not +/- something else
94-
val separator = isoString.indexOf(':', offset) // if there is a ':' in the offset, no changes needed
95-
return if (separator != -1) isoString else "$isoString:00"
96-
}
97-
9886
public actual fun fromEpochSeconds(epochSeconds: Long, nanosecondAdjustment: Long): Instant = try {
9987
/* Performing normalization here because otherwise this fails:
10088
assertEquals((Long.MAX_VALUE % 1_000_000_000).toInt(),

core/jvm/src/Instant.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ import kotlinx.datetime.internal.*
1212
import kotlinx.datetime.serializers.InstantIso8601Serializer
1313
import kotlinx.serialization.Serializable
1414
import java.time.DateTimeException
15-
import java.time.format.*
1615
import java.time.temporal.*
1716
import kotlin.time.*
1817
import kotlin.time.Duration.Companion.nanoseconds
1918
import kotlin.time.Duration.Companion.seconds
2019
import java.time.Instant as jtInstant
21-
import java.time.OffsetDateTime as jtOffsetDateTime
2220
import java.time.Clock as jtClock
2321

2422
@Serializable(with = InstantIso8601Serializer::class)
@@ -83,17 +81,6 @@ public actual class Instant internal constructor(internal val value: jtInstant)
8381
@Deprecated("This overload is only kept for binary compatibility", level = DeprecationLevel.HIDDEN)
8482
public fun parse(isoString: String): Instant = parse(input = isoString)
8583

86-
/** A workaround for a quirk of the JDKs older than 11 where the string representations of Instant that have an
87-
* offset of the form "+XX" are not recognized by [jtOffsetDateTime.parse], while "+XX:XX" work fine. */
88-
private fun fixOffsetRepresentation(isoString: CharSequence): CharSequence {
89-
val time = isoString.indexOf('T', ignoreCase = true)
90-
if (time == -1) return isoString // the string is malformed
91-
val offset = isoString.indexOfLast { c -> c == '+' || c == '-' }
92-
if (offset < time) return isoString // the offset is 'Z' and not +/- something else
93-
val separator = isoString.indexOf(':', offset) // if there is a ':' in the offset, no changes needed
94-
return if (separator != -1) isoString else "$isoString:00"
95-
}
96-
9784
public actual fun fromEpochSeconds(epochSeconds: Long, nanosecondAdjustment: Long): Instant = try {
9885
Instant(jtInstant.ofEpochSecond(epochSeconds, nanosecondAdjustment))
9986
} catch (e: Exception) {

0 commit comments

Comments
 (0)