diff options
Diffstat (limited to 'platform/windows/os_windows.cpp')
| -rw-r--r-- | platform/windows/os_windows.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 4e8f9fcd9..cdf9b007d 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1832,7 +1832,10 @@ String OS_Windows::get_name() { OS::Date OS_Windows::get_date() const { SYSTEMTIME systemtime; - GetSystemTime(&systemtime); + if (local) + GetSystemTime(&systemtime); + else + GetLocalTime(&systemtime); Date date; date.day=systemtime.wDay; date.month=Month(systemtime.wMonth); @@ -1841,10 +1844,13 @@ OS::Date OS_Windows::get_date() const { date.dst=false; return date; } -OS::Time OS_Windows::get_time() const { +OS::Time OS_Windows::get_time(bool utc) const { SYSTEMTIME systemtime; - GetLocalTime(&systemtime); + if (utc) + GetSystemTime(&systemtime); + else + GetLocalTime(&systemtime); Time time; time.hour=systemtime.wHour; @@ -1852,8 +1858,38 @@ OS::Time OS_Windows::get_time() 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() const { +uint64_t OS_Windows::get_unix_time(bool local) const { FILETIME ft; SYSTEMTIME st; |
