From c5338fd6c40d08472b680809cfa04d47826bdcf5 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 6 Jun 2015 05:35:38 +0200 Subject: Add OS.get_time_zone_info function The returned dictionary maps "name" to the name of the current time zone, and "bias" to a bias from UTC in minutes. --- core/bind/core_bind.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/bind/core_bind.cpp') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 700856ab6..26b1dac6f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -480,6 +480,15 @@ Dictionary _OS::get_time(bool utc) const { return timed; } + +Dictionary _OS::get_time_zone_info() const { + OS::TimeZoneInfo info = OS::get_singleton()->get_time_zone_info(); + Dictionary infod; + infod["bias"] = info.bias; + infod["name"] = info.name; + return infod; +} + uint64_t _OS::get_unix_time() const { return OS::get_singleton()->get_unix_time(); @@ -776,6 +785,7 @@ void _OS::_bind_methods() { 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_time_zone_info"),&_OS::get_time_zone_info); ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time); ObjectTypeDB::bind_method(_MD("set_icon"),&_OS::set_icon); -- cgit v1.2.3-70-g09d2