Skip to content

Commit 8c2a115

Browse files
authored
feat(rt): add MIN/MAX values to Instant (#719)
1 parent d0d327f commit 8c2a115

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "3c662a11-98c2-48cc-8cf5-ca0b293db1f9",
3+
"type": "feature",
4+
"description": "add `MIN` and `MAX` accessors for the Instant type"
5+
}

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/time/Instant.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ public expect class Instant : Comparable<Instant> {
6868
* Create an [Instant] from the current system time
6969
*/
7070
public fun now(): Instant
71+
72+
/**
73+
* Create an [Instant] with the minimum possible value
74+
*/
75+
public val MIN_VALUE: Instant
76+
77+
/**
78+
* Create an [Instant] with the maximum possible value
79+
*/
80+
public val MAX_VALUE: Instant
7181
}
7282
}
7383

runtime/runtime-core/jvm/src/aws/smithy/kotlin/runtime/time/InstantJVM.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ public actual class Instant(internal val value: jtInstant) : Comparable<Instant>
125125
* Create an [Instant] from the current system time
126126
*/
127127
public actual fun now(): Instant = Instant(jtInstant.now())
128+
129+
/**
130+
* Create an [Instant] with the minimum possible value
131+
*/
132+
public actual val MIN_VALUE: Instant = Instant(jtInstant.MIN)
133+
134+
/**
135+
* Create an [Instant] with the maximum possible value
136+
*/
137+
public actual val MAX_VALUE: Instant = Instant(jtInstant.MAX)
128138
}
129139
}
130140

0 commit comments

Comments
 (0)