File tree Expand file tree Collapse file tree 2 files changed +0
-22
lines changed Expand file tree Collapse file tree 2 files changed +0
-22
lines changed Original file line number Diff line number Diff line change @@ -84,17 +84,6 @@ public actual class Instant internal constructor(internal val value: jtInstant)
84
84
@Deprecated(" This overload is only kept for binary compatibility" , level = DeprecationLevel .HIDDEN )
85
85
public fun parse (isoString : String ): Instant = parse(input = isoString)
86
86
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
-
98
87
public actual fun fromEpochSeconds (epochSeconds : Long , nanosecondAdjustment : Long ): Instant = try {
99
88
/* Performing normalization here because otherwise this fails:
100
89
assertEquals((Long.MAX_VALUE % 1_000_000_000).toInt(),
Original file line number Diff line number Diff line change @@ -83,17 +83,6 @@ public actual class Instant internal constructor(internal val value: jtInstant)
83
83
@Deprecated(" This overload is only kept for binary compatibility" , level = DeprecationLevel .HIDDEN )
84
84
public fun parse (isoString : String ): Instant = parse(input = isoString)
85
85
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
-
97
86
public actual fun fromEpochSeconds (epochSeconds : Long , nanosecondAdjustment : Long ): Instant = try {
98
87
Instant (jtInstant.ofEpochSecond(epochSeconds, nanosecondAdjustment))
99
88
} catch (e: Exception ) {
You can’t perform that action at this time.
0 commit comments