mirror of https://github.com/hykilpikonna/AquaDX
[F] Fix timezones
parent
b52916e62c
commit
5c80aec50b
|
@ -20,6 +20,8 @@ import java.nio.file.Path
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
import java.time.ZoneId
|
||||||
|
import java.time.ZonedDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.locks.Lock
|
import java.util.concurrent.locks.Lock
|
||||||
|
@ -107,6 +109,8 @@ inline fun <reified T> resJson(name: Str, warn: Boolean = true) = resStr(name)?.
|
||||||
} ?: run { if (warn) Ext.log.warn("Resource $name is not found"); null }
|
} ?: run { if (warn) Ext.log.warn("Resource $name is not found"); null }
|
||||||
|
|
||||||
// Date and time
|
// Date and time
|
||||||
|
val JST_ZONE = ZoneId.of("Asia/Tokyo")
|
||||||
|
fun jstNow() = LocalDateTime.now(JST_ZONE)
|
||||||
fun millis() = System.currentTimeMillis()
|
fun millis() = System.currentTimeMillis()
|
||||||
val DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
val DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||||
fun LocalDate.isoDate() = format(DATE_FORMAT)
|
fun LocalDate.isoDate() = format(DATE_FORMAT)
|
||||||
|
@ -224,3 +228,4 @@ val <S> Pair<*, S>.r get() = component2()
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
val Query.exec get() = resultList.map { (it as Array<*>).toList() }
|
val Query.exec get() = resultList.map { (it as Array<*>).toList() }
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import icu.samnyan.aqua.sega.chusan.model.response.data.UserEmoney
|
||||||
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCharge
|
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCharge
|
||||||
import icu.samnyan.aqua.sega.chusan.model.userdata.UserMusicDetail
|
import icu.samnyan.aqua.sega.chusan.model.userdata.UserMusicDetail
|
||||||
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating
|
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@ -193,6 +192,7 @@ val chusanInit: ChusanController.() -> Unit = {
|
||||||
// Get the request url as te address
|
// Get the request url as te address
|
||||||
val addr = (req.getHeader("wrapper original url") ?: req.requestURL.toString())
|
val addr = (req.getHeader("wrapper original url") ?: req.requestURL.toString())
|
||||||
.removeSuffix("GetGameSettingApi")
|
.removeSuffix("GetGameSettingApi")
|
||||||
|
val now = jstNow()
|
||||||
|
|
||||||
mapOf(
|
mapOf(
|
||||||
"gameSetting" to mapOf(
|
"gameSetting" to mapOf(
|
||||||
|
@ -200,14 +200,14 @@ val chusanInit: ChusanController.() -> Unit = {
|
||||||
"dataVersion" to versionHelper[data["clientId"].toString()],
|
"dataVersion" to versionHelper[data["clientId"].toString()],
|
||||||
"isMaintenance" to false,
|
"isMaintenance" to false,
|
||||||
"requestInterval" to 0,
|
"requestInterval" to 0,
|
||||||
"rebootStartTime" to LocalDateTime.now().minusHours(3).format(fmt),
|
"rebootStartTime" to now.minusHours(4).format(fmt),
|
||||||
"rebootEndTime" to LocalDateTime.now().minusHours(2).format(fmt),
|
"rebootEndTime" to now.minusHours(3).format(fmt),
|
||||||
"isBackgroundDistribute" to false,
|
"isBackgroundDistribute" to false,
|
||||||
"maxCountCharacter" to 300,
|
"maxCountCharacter" to 300,
|
||||||
"maxCountItem" to 300,
|
"maxCountItem" to 300,
|
||||||
"maxCountMusic" to 300,
|
"maxCountMusic" to 300,
|
||||||
"matchStartTime" to LocalDateTime.now().minusHours(5).format(fmt),
|
"matchStartTime" to now.minusHours(1).format(fmt),
|
||||||
"matchEndTime" to LocalDateTime.now().plusHours(5).format(fmt),
|
"matchEndTime" to now.plusHours(7).format(fmt),
|
||||||
"matchTimeLimit" to 10,
|
"matchTimeLimit" to 10,
|
||||||
"matchErrorLimit" to 10,
|
"matchErrorLimit" to 10,
|
||||||
"matchingUri" to addr,
|
"matchingUri" to addr,
|
||||||
|
|
Loading…
Reference in New Issue