Reference
GameDateTime
Public Kotlin SDK declarations.
Usage context
| Module | Package | SDK source |
|---|---|---|
| Kotlin/Native | nimby | kotlin/src/nimby/GameDateTime.kt |
Public API for SDK 0.9.0-alpha.2. Each entry provides the Kotlin signature and its contract: what the value means, conditions of use and effects to understand. Choose imports from the module shown above.
import nimby.GameDateTime
import nimby.dateTimeGameDateTime
data class GameDateTime(val year: Int, val month: Int, val day: Int,
val hour: Int = 0, val minute: Int = 0, val second: Int = 0)UTC Gregorian date and time, to the second, validated at construction. Years range from 1 to 9999; invalid dates are not normalized. This value alone does not change the game.
GameDateTime.year
val year: IntUTC year from 1 to 9999. Leap years follow the Gregorian calendar.
GameDateTime.month
val month: IntUTC month from 1 (January) to 12 (December).
GameDateTime.day
val day: IntDay of month, starting at 1; the upper bound depends on the month and leap year.
GameDateTime.hour
val hour: Int = 0UTC hour from 0 to 23; defaults to zero.
GameDateTime.minute
val minute: Int = 0Minute from 0 to 59; defaults to zero.
GameDateTime.second
val second: Int = 0Second from 0 to 59; defaults to zero. Leap seconds are not accepted.
GameDateTime.toUtcSeconds
fun toUtcSeconds(): LongConverts the date to signed seconds since 1 January 1970 UTC. Earlier dates produce negative values; no game access occurs.
GameDateTime.toString
override fun toString(): StringFormats the date as YYYY-MM-DDTHH:mm:ssZ, independently of language and the computer’s time zone.
GameDateTime.Companion.fromUtcSeconds
fun fromUtcSeconds(seconds: Long): GameDateTimeConverts signed UTC seconds to a date. Accepts −62135596800 through 253402300799 inclusive; rejects values outside years 1 to 9999.
dateTime
fun ToolClock.dateTime(): GameDateTimeConverts this reading’s utcSeconds to a UTC date. Neither rereads nor changes the clock; elapsedMillis is not used for conversion.