1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-07 17:36:07 +00:00

Add utc param to get_time and get_date methods

If utc == false, we return the local time, like before.
Otherwise, we return UTC time.
utc defaults to false to not break behaviour.
This commit is contained in:
est31
2015-06-06 03:40:56 +02:00
parent 26ea12a873
commit 803069886e
11 changed files with 62 additions and 35 deletions

View File

@@ -457,9 +457,9 @@ void _OS::set_icon(const Image& p_icon) {
OS::get_singleton()->set_icon(p_icon);
}
Dictionary _OS::get_date() const {
Dictionary _OS::get_date(bool utc) const {
OS::Date date = OS::get_singleton()->get_date();
OS::Date date = OS::get_singleton()->get_date(utc);
Dictionary dated;
dated["year"]=date.year;
dated["month"]=date.month;
@@ -470,9 +470,9 @@ Dictionary _OS::get_date() const {
}
Dictionary _OS::get_time() const {
Dictionary _OS::get_time(bool utc) const {
OS::Time time = OS::get_singleton()->get_time();
OS::Time time = OS::get_singleton()->get_time(utc);
Dictionary timed;
timed["hour"]=time.hour;
timed["minute"]=time.min;
@@ -774,8 +774,8 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args);
ObjectTypeDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop);
ObjectTypeDB::bind_method(_MD("get_date"),&_OS::get_date);
ObjectTypeDB::bind_method(_MD("get_time"),&_OS::get_time);
ObjectTypeDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_time","utc"),&_OS::get_time,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time);
ObjectTypeDB::bind_method(_MD("set_icon"),&_OS::set_icon);