NRF SDK 0.9

Reference

GameDateTime

Public Kotlin SDK declarations.

Usage context

ModulePackageSDK source
Kotlin/Nativenimbykotlin/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.

Imports on this page
import nimby.GameDateTime
import nimby.dateTime

GameDateTime

nimby · class
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

nimby · val
val year: Int

UTC year from 1 to 9999. Leap years follow the Gregorian calendar.

GameDateTime.month

nimby · val
val month: Int

UTC month from 1 (January) to 12 (December).

GameDateTime.day

nimby · val
val day: Int

Day of month, starting at 1; the upper bound depends on the month and leap year.

GameDateTime.hour

nimby · val
val hour: Int = 0

UTC hour from 0 to 23; defaults to zero.

GameDateTime.minute

nimby · val
val minute: Int = 0

Minute from 0 to 59; defaults to zero.

GameDateTime.second

nimby · val
val second: Int = 0

Second from 0 to 59; defaults to zero. Leap seconds are not accepted.

GameDateTime.toUtcSeconds

nimby · fun
fun toUtcSeconds(): Long

Converts the date to signed seconds since 1 January 1970 UTC. Earlier dates produce negative values; no game access occurs.

GameDateTime.toString

nimby · fun
override fun toString(): String

Formats the date as YYYY-MM-DDTHH:mm:ssZ, independently of language and the computer’s time zone.

GameDateTime.Companion.fromUtcSeconds

nimby · fun
fun fromUtcSeconds(seconds: Long): GameDateTime

Converts signed UTC seconds to a date. Accepts −62135596800 through 253402300799 inclusive; rejects values outside years 1 to 9999.

dateTime

nimby · fun
fun ToolClock.dateTime(): GameDateTime

Converts this reading’s utcSeconds to a UTC date. Neither rereads nor changes the clock; elapsedMillis is not used for conversion.