summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-13 11:01:12 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-13 11:01:12 +0200
commitff824b6f9d5bfa021ff788731a7e135afc95accd (patch)
treedc5a0174dfe884a8102ddb4c5785fc04be24783e /core/io
parent3a82a1315b31221507808a540d8657af835f27ca (diff)
parent0aecfc92540618508568b5c7e8a050d36cf5322b (diff)
Merge pull request #65509 from gotnospirit/master-os-get_datetime
get_datetime_* functions can return wrong values
Diffstat (limited to 'core/io')
-rw-r--r--core/io/resource.cpp15
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;