diff options
author | est31 <MTest31@outlook.com> | 2015-06-06 05:35:38 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-06-06 05:57:33 +0200 |
commit | c5338fd6c40d08472b680809cfa04d47826bdcf5 (patch) | |
tree | d9cbdebd87b97616e0cbd52e46ad6887f01d90e1 /platform/windows | |
parent | 803069886ebca492c0d5f47133ccf7833c716e5a (diff) |
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.
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/os_windows.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 16b9e9b327..cdf9b007d1 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1858,6 +1858,36 @@ OS::Time OS_Windows::get_time(bool utc) const { time.sec=systemtime.wSecond; return time; } +OS::Time OS_Windows::get_time(bool utc) const { + + SYSTEMTIME systemtime; + if (utc) + GetSystemTime(&systemtime); + else + GetLocalTime(&systemtime); + + Time time; + time.hour=systemtime.wHour; + time.min=systemtime.wMinute; + time.sec=systemtime.wSecond; + return time; +} + +OS::TimeZoneInfo OS_Windows::get_time_zone_info() const { + TIME_ZONE_INFORMATION info; + bool daylight = false; + if (GetTimeZoneInformation(info) == TIME_ZONE_ID_DAYLIGHT) + daylight = true; + + if (daylight) { + ret.name = info.DaylightName; + } else { + ret.name = info.StandardName; + } + + ret.bias = info.Bias; + return ret; +} uint64_t OS_Windows::get_unix_time(bool local) const { |