Merge pull request #46926 from unsignedFoo/46188/fix-get-unix-from-datetime-empty-dict
[46188] fix: get unix from datetime when empty dict
This commit is contained in:
commit
3231edb779
|
@ -373,6 +373,9 @@ Dictionary _OS::get_time(bool utc) const {
|
||||||
* @return epoch calculated
|
* @return epoch calculated
|
||||||
*/
|
*/
|
||||||
int64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
|
int64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
|
||||||
|
// if datetime is an empty Dictionary throws an error
|
||||||
|
ERR_FAIL_COND_V_MSG(datetime.is_empty(), 0, "Invalid datetime Dictionary: Dictionary is empty");
|
||||||
|
|
||||||
// Bunch of conversion constants
|
// Bunch of conversion constants
|
||||||
static const unsigned int SECONDS_PER_MINUTE = 60;
|
static const unsigned int SECONDS_PER_MINUTE = 60;
|
||||||
static const unsigned int MINUTES_PER_HOUR = 60;
|
static const unsigned int MINUTES_PER_HOUR = 60;
|
||||||
|
|
|
@ -367,6 +367,7 @@
|
||||||
<description>
|
<description>
|
||||||
Gets an epoch time value from a dictionary of time values.
|
Gets an epoch time value from a dictionary of time values.
|
||||||
[code]datetime[/code] must be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], [code]second[/code].
|
[code]datetime[/code] must be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], [code]second[/code].
|
||||||
|
If the dictionary is empty [code]0[/code] is returned.
|
||||||
You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight Savings Time ([code]dst[/code]), if present, is ignored.
|
You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight Savings Time ([code]dst[/code]), if present, is ignored.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
|
Loading…
Reference in New Issue