diff options
Diffstat (limited to 'platform/winrt')
-rw-r--r-- | platform/winrt/os_winrt.cpp | 32 | ||||
-rw-r--r-- | platform/winrt/os_winrt.h | 4 |
2 files changed, 29 insertions, 7 deletions
diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp index 21a77b89cb..24037f05d7 100644 --- a/platform/winrt/os_winrt.cpp +++ b/platform/winrt/os_winrt.cpp @@ -445,7 +445,7 @@ String OSWinrt::get_name() { OS::Date OSWinrt::get_date() const { SYSTEMTIME systemtime; - GetSystemTime(&systemtime); + GetLocalTime(&systemtime); Date date; date.day=systemtime.wDay; date.month=Month(systemtime.wMonth); @@ -454,10 +454,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 +469,30 @@ OS::Time OSWinrt::get_time() const { return time; } -uint64_t OSWinrt::get_unix_time() const { +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 OSWinrt::get_unix_time(bool utc) const { FILETIME ft; SYSTEMTIME st; - GetSystemTime(&st); + if (utc) + GetSystemTime(&systemtime); + else + GetLocalTime(&systemtime); SystemTimeToFileTime(&st, &ft); SYSTEMTIME ep; diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h index 68236309a9..af44bd338e 100644 --- a/platform/winrt/os_winrt.h +++ b/platform/winrt/os_winrt.h @@ -198,8 +198,8 @@ public: virtual String get_name(); - virtual Date get_date() const; - virtual Time get_time() const; + virtual Date get_date(bool utc) const; + virtual Time get_time(bool utc) const; virtual uint64_t get_unix_time() const; virtual bool can_draw() const; |