Skip to content

Commit 43a9dfb

Browse files
committed
ktlint
1 parent 5cdf2dd commit 43a9dfb

File tree

3 files changed

+36
-18
lines changed

3 files changed

+36
-18
lines changed

runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/time/InstantTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class InstantTest {
120120
FromTest("Thu, 05 Nov 2020 19:22:37 +1245", 1604558257, 0),
121121
FromTest("Thu, 05 Nov 2020 19:22:37 -1245", 1604650057, 0),
122122
)
123+
123124
@Test
124125
fun testFromRfc5322() {
125126
for ((idx, test) in rfc5322Tests.withIndex()) {
@@ -299,4 +300,3 @@ class V2JavaSdkTests {
299300
// (2) - The input year in those tests is NOT valid and should never have
300301
// been accepted by the parser.
301302
}
302-

runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/time/DateTimeFormats.kt

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,39 @@ internal object DateTimeFormats {
1818
// e.g. "2020-11-05T19:22:37+00:00"
1919
val ISO_8601 = DateTimeComponents.Format {
2020
// Two possible date formats: YYYY-MM-DD or YYYYMMDD
21-
alternativeParsing ({
22-
date(LocalDate.Format { year(); monthNumber(); dayOfMonth() })
21+
alternativeParsing({
22+
date(
23+
LocalDate.Format {
24+
year()
25+
monthNumber()
26+
dayOfMonth()
27+
},
28+
)
2329
}) {
24-
date(LocalDate.Format {
25-
year(); char('-'); monthNumber(); char('-'); dayOfMonth()
26-
})
30+
date(
31+
LocalDate.Format {
32+
year()
33+
char('-')
34+
monthNumber()
35+
char('-')
36+
dayOfMonth()
37+
},
38+
)
2739
}
2840

2941
char('T')
3042

3143
// Two possible time formats: HH:MM:SS or HHMMSS
3244
alternativeParsing({
33-
hour(); minute(); second()
45+
hour()
46+
minute()
47+
second()
3448
}) {
35-
hour(); char(':'); minute(); char(':'); second()
49+
hour()
50+
char(':')
51+
minute()
52+
char(':')
53+
second()
3654
}
3755

3856
// Fractional seconds (up to 6 digits)
@@ -90,4 +108,4 @@ internal object DateTimeFormats {
90108
offset(UtcOffset.Formats.FOUR_DIGITS)
91109
}
92110
}
93-
}
111+
}

runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/time/InstantNative.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ public actual class Instant(internal val delegate: ktInstant) : Comparable<Insta
3232
/**
3333
* Encode the [Instant] as a string into the format specified by [TimestampFormat]
3434
*/
35-
public actual fun format(fmt: TimestampFormat): String {
36-
return when (fmt) {
37-
TimestampFormat.EPOCH_SECONDS -> {
38-
val s = delegate.epochSeconds.toString()
39-
val ns = if (delegate.nanosecondsOfSecond != 0) {
40-
".${delegate.nanosecondsOfSecond.toString().padStart(9, '0').trimEnd('0')}"
41-
} else ""
42-
s + ns
35+
public actual fun format(fmt: TimestampFormat): String = when (fmt) {
36+
TimestampFormat.EPOCH_SECONDS -> {
37+
val s = delegate.epochSeconds.toString()
38+
val ns = if (delegate.nanosecondsOfSecond != 0) {
39+
".${delegate.nanosecondsOfSecond.toString().padStart(9, '0').trimEnd('0')}"
40+
} else {
41+
""
4342
}
44-
else -> delegate.format(fmt.asDateTimeFormat())
43+
s + ns
4544
}
45+
else -> delegate.format(fmt.asDateTimeFormat())
4646
}
4747

4848
/**

0 commit comments

Comments
 (0)