From 0aecfc92540618508568b5c7e8a050d36cf5322b Mon Sep 17 00:00:00 2001 From: James Date: Thu, 8 Sep 2022 13:36:10 +0800 Subject: Fixes #65377: get_datetime_* functions can return wrong values --- core/io/resource.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'core/io') diff --git a/core/io/resource.cpp b/core/io/resource.cpp index d117f86f39..553698f8a6 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -93,15 +93,14 @@ String Resource::get_path() const { String Resource::generate_scene_unique_id() { // Generate a unique enough hash, but still user-readable. // If it's not unique it does not matter because the saver will try again. - OS::Date date = OS::get_singleton()->get_date(); - OS::Time time = OS::get_singleton()->get_time(); + OS::DateTime dt = OS::get_singleton()->get_datetime(); uint32_t hash = hash_murmur3_one_32(OS::get_singleton()->get_ticks_usec()); - hash = hash_murmur3_one_32(date.year, hash); - hash = hash_murmur3_one_32(date.month, hash); - hash = hash_murmur3_one_32(date.day, hash); - hash = hash_murmur3_one_32(time.hour, hash); - hash = hash_murmur3_one_32(time.minute, hash); - hash = hash_murmur3_one_32(time.second, hash); + hash = hash_murmur3_one_32(dt.year, hash); + hash = hash_murmur3_one_32(dt.month, hash); + hash = hash_murmur3_one_32(dt.day, hash); + hash = hash_murmur3_one_32(dt.hour, hash); + hash = hash_murmur3_one_32(dt.minute, hash); + hash = hash_murmur3_one_32(dt.second, hash); hash = hash_murmur3_one_32(Math::rand(), hash); static constexpr uint32_t characters = 5; -- cgit v1.2.3