summaryrefslogtreecommitdiffstats
path: root/core/os/time.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/os/time.cpp')
-rw-r--r--core/os/time.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/os/time.cpp b/core/os/time.cpp
index bad5cc2e4f..d1d3588d09 100644
--- a/core/os/time.cpp
+++ b/core/os/time.cpp
@@ -189,9 +189,6 @@ static const uint8_t MONTH_DAYS_TABLE[2][12] = {
Time *Time::singleton = nullptr;
Time *Time::get_singleton() {
- if (!singleton) {
- memnew(Time);
- }
return singleton;
}
@@ -258,7 +255,7 @@ String Time::get_time_string_from_unix_time(int64_t p_unix_time_val) const {
return vformat("%02d:%02d:%02d", hour, minute, second);
}
-Dictionary Time::get_datetime_dict_from_datetime_string(String p_datetime, bool p_weekday) const {
+Dictionary Time::get_datetime_dict_from_datetime_string(const String &p_datetime, bool p_weekday) const {
PARSE_ISO8601_STRING(Dictionary())
Dictionary dict;
dict[YEAR_KEY] = year;
@@ -276,7 +273,7 @@ Dictionary Time::get_datetime_dict_from_datetime_string(String p_datetime, bool
return dict;
}
-String Time::get_datetime_string_from_datetime_dict(const Dictionary p_datetime, bool p_use_space) const {
+String Time::get_datetime_string_from_datetime_dict(const Dictionary &p_datetime, bool p_use_space) const {
ERR_FAIL_COND_V_MSG(p_datetime.is_empty(), "", "Invalid datetime Dictionary: Dictionary is empty.");
EXTRACT_FROM_DICTIONARY
VALIDATE_YMDHMS("")
@@ -290,7 +287,7 @@ String Time::get_datetime_string_from_datetime_dict(const Dictionary p_datetime,
return timestamp;
}
-int64_t Time::get_unix_time_from_datetime_dict(const Dictionary p_datetime) const {
+int64_t Time::get_unix_time_from_datetime_dict(const Dictionary &p_datetime) const {
ERR_FAIL_COND_V_MSG(p_datetime.is_empty(), 0, "Invalid datetime Dictionary: Dictionary is empty");
EXTRACT_FROM_DICTIONARY
VALIDATE_YMDHMS(0)
@@ -298,7 +295,7 @@ int64_t Time::get_unix_time_from_datetime_dict(const Dictionary p_datetime) cons
return day_number * SECONDS_PER_DAY + hour * 3600 + minute * 60 + second;
}
-int64_t Time::get_unix_time_from_datetime_string(String p_datetime) const {
+int64_t Time::get_unix_time_from_datetime_string(const String &p_datetime) const {
PARSE_ISO8601_STRING(-1)
VALIDATE_YMDHMS(0)
YMD_TO_DAY_NUMBER