diff options
Diffstat (limited to 'platform/winrt/os_winrt.cpp')
-rw-r--r-- | platform/winrt/os_winrt.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp index 21a77b89cb..3e06d9d59b 100644 --- a/platform/winrt/os_winrt.cpp +++ b/platform/winrt/os_winrt.cpp @@ -442,10 +442,14 @@ String OSWinrt::get_name() { return "WinRT"; } -OS::Date OSWinrt::get_date() const { +OS::Date OSWinrt::get_date(bool utc) const { SYSTEMTIME systemtime; - GetSystemTime(&systemtime); + if (utc) + GetSystemTime(&systemtime); + else + GetLocalTime(&systemtime); + Date date; date.day=systemtime.wDay; date.month=Month(systemtime.wMonth); @@ -454,10 +458,13 @@ OS::Date OSWinrt::get_date() const { date.dst=false; return date; } -OS::Time OSWinrt::get_time() const { +OS::Time OSWinrt::get_time(bool utc) const { SYSTEMTIME systemtime; - GetSystemTime(&systemtime); + if (utc) + GetSystemTime(&systemtime); + else + GetLocalTime(&systemtime); Time time; time.hour=systemtime.wHour; @@ -466,11 +473,28 @@ OS::Time OSWinrt::get_time() const { 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; + + TimeZoneInfo ret; + if (daylight) { + ret.name = info.DaylightName; + } else { + ret.name = info.StandardName; + } + + ret.bias = info.Bias; + return ret; +} + uint64_t OSWinrt::get_unix_time() const { FILETIME ft; SYSTEMTIME st; - GetSystemTime(&st); + GetSystemTime(&systemtime); SystemTimeToFileTime(&st, &ft); SYSTEMTIME ep; |