diff options
author | James <gotnospirit@gmail.com> | 2022-09-08 13:36:10 +0800 |
---|---|---|
committer | James <gotnospirit@gmail.com> | 2022-09-10 07:58:38 +0800 |
commit | 0aecfc92540618508568b5c7e8a050d36cf5322b (patch) | |
tree | ad7fe94efad6acb9deb5c160ba672cf37f9f8b0f /core/io | |
parent | 27e132347324318567419ac5039d51338d7d4f0e (diff) |
Fixes #65377: get_datetime_* functions can return wrong values
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/resource.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
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; |