From cde873b4064360da01a9ffd92956e7d89e2c3eae Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Thu, 15 Aug 2024 12:24:58 -0700 Subject: [PATCH] Update the Android `fileLastModified` method to return values in seconds instead of milliseconds --- .../java/lib/src/org/godotengine/godot/io/file/FileData.kt | 2 +- .../lib/src/org/godotengine/godot/io/file/MediaStoreData.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt index f2c0577c21e..d0b8a8dffae 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt @@ -53,7 +53,7 @@ internal class FileData(filePath: String, accessFlag: FileAccessFlags) : DataAcc fun fileLastModified(filepath: String): Long { return try { - File(filepath).lastModified() + File(filepath).lastModified() / 1000L } catch (e: SecurityException) { 0L } diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt index 5410eed7272..146fc04da49 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt @@ -203,7 +203,7 @@ internal class MediaStoreData(context: Context, filePath: String, accessFlag: Fi } val dataItem = result[0] - return dataItem.dateModified.toLong() + return dataItem.dateModified.toLong() / 1000L } fun rename(context: Context, from: String, to: String): Boolean {