From dc5ecb40ccda25618916b20efcac2679c382f49a Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Mon, 7 Oct 2024 12:22:51 +0200 Subject: [PATCH] Rewrite TimetokeUtils.java to kotlin. --- .../src/main/java/com/pubnub/api/java/util/TimetokenUtil.kt | 1 + .../src/commonMain/kotlin/com/pubnub/api/utils/TimetokenUtil.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/util/TimetokenUtil.kt b/pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/util/TimetokenUtil.kt index 1fd72ca87..da90ee8cf 100644 --- a/pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/util/TimetokenUtil.kt +++ b/pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/util/TimetokenUtil.kt @@ -83,6 +83,7 @@ class TimetokenUtil { * * @param timetoken The PubNub timetoken to be converted to a Unix timestamp. * @return A [Long] representing the Unix timestamp in millis corresponding to the given timetoken. + * @throws IllegalArgumentException if the timetoken does not have 17 digits. */ @JvmStatic fun timetokenToUnix(timetoken: Long): Long { diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/utils/TimetokenUtil.kt b/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/utils/TimetokenUtil.kt index 55ce24b7a..cabedab21 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/utils/TimetokenUtil.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/utils/TimetokenUtil.kt @@ -80,6 +80,7 @@ class TimetokenUtil { * * @param timetoken The PubNub timetoken to be converted to a Unix timestamp. * @return A [Long] representing the Unix timestamp in millis corresponding to the given timetoken. + * @throws IllegalArgumentException if the timetoken does not have 17 digits. */ fun timetokenToUnix(timetoken: Long): Long { if (isLengthDifferentThan17Digits(timetoken)) {