From bb1d805080955bac88fccde13bda23923221d9dc Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 29 Sep 2025 18:06:58 -0400 Subject: [PATCH] Removes the need to use kotlinx.datetime on quartz --- quartz/build.gradle.kts | 2 +- .../quartz/nip03Timestamp/ots/VerifyResult.kt | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/quartz/build.gradle.kts b/quartz/build.gradle.kts index e15428326..be89e1e5d 100644 --- a/quartz/build.gradle.kts +++ b/quartz/build.gradle.kts @@ -107,7 +107,7 @@ kotlin { implementation(libs.kotlinx.serialization.json) // in your shared module's dependencies block - implementation( libs.kotlinx.datetime) + // implementation( libs.kotlinx.datetime) // immutable collections to avoid recomposition implementation(libs.kotlinx.collections.immutable) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/VerifyResult.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/VerifyResult.kt index d0cf6daa5..7b368c37c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/VerifyResult.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/VerifyResult.kt @@ -20,12 +20,6 @@ */ package com.vitorpamplona.quartz.nip03Timestamp.ots -import kotlinx.datetime.TimeZone -import kotlinx.datetime.number -import kotlinx.datetime.toLocalDateTime -import kotlin.time.ExperimentalTime -import kotlin.time.Instant - /** * Class that lets us compare, sort, store and print timestamps. */ @@ -38,19 +32,12 @@ class VerifyResult( /** * Returns, if existing, a string representation describing the existence of a block attest */ - @OptIn(ExperimentalTime::class) override fun toString(): String { if (height == 0 || timestamp == null) { return "" } - // 1. Create an Instant from the Unix timestamp (milliseconds) - val instant = Instant.fromEpochMilliseconds(timestamp * 1000) - - // 2. Convert the Instant to a LocalDateTime in the UTC time zone - val dateTime = instant.toLocalDateTime(TimeZone.UTC) - - return "block $height attests data existed as of ${dateTime.year}-${dateTime.month.number}-${dateTime.day} UTC" + return "block $height attests data existed as of unix timestamp of $timestamp" } override fun compareTo(other: VerifyResult): Int = this.height - other.height