Fix windows compilability

This commit is contained in:
est31 2015-06-07 15:06:13 +02:00
parent 8d61817293
commit 64704ecbc5
4 changed files with 19 additions and 29 deletions

View file

@ -1829,22 +1829,7 @@ String OS_Windows::get_name() {
return "Windows"; return "Windows";
} }
OS::Date OS_Windows::get_date() const { OS::Date OS_Windows::get_date(bool utc) const {
SYSTEMTIME systemtime;
if (local)
GetSystemTime(&systemtime);
else
GetLocalTime(&systemtime);
Date date;
date.day=systemtime.wDay;
date.month=Month(systemtime.wMonth);
date.weekday=Weekday(systemtime.wDayOfWeek);
date.year=systemtime.wYear;
date.dst=false;
return date;
}
OS::Time OS_Windows::get_time(bool utc) const {
SYSTEMTIME systemtime; SYSTEMTIME systemtime;
if (utc) if (utc)
@ -1852,11 +1837,13 @@ OS::Time OS_Windows::get_time(bool utc) const {
else else
GetLocalTime(&systemtime); GetLocalTime(&systemtime);
Time time; Date date;
time.hour=systemtime.wHour; date.day=systemtime.wDay;
time.min=systemtime.wMinute; date.month=Month(systemtime.wMonth);
time.sec=systemtime.wSecond; date.weekday=Weekday(systemtime.wDayOfWeek);
return time; date.year=systemtime.wYear;
date.dst=false;
return date;
} }
OS::Time OS_Windows::get_time(bool utc) const { OS::Time OS_Windows::get_time(bool utc) const {
@ -1889,7 +1876,7 @@ OS::TimeZoneInfo OS_Windows::get_time_zone_info() const {
return ret; return ret;
} }
uint64_t OS_Windows::get_unix_time(bool local) const { uint64_t OS_Windows::get_unix_time() const {
FILETIME ft; FILETIME ft;
SYSTEMTIME st; SYSTEMTIME st;

View file

@ -261,6 +261,7 @@ public:
virtual Date get_date(bool utc) const; virtual Date get_date(bool utc) const;
virtual Time get_time(bool utc) const; virtual Time get_time(bool utc) const;
virtual TimeZoneInfo get_time_zone_info() const;
virtual uint64_t get_unix_time() const; virtual uint64_t get_unix_time() const;
virtual bool can_draw() const; virtual bool can_draw() const;

View file

@ -442,10 +442,14 @@ String OSWinrt::get_name() {
return "WinRT"; return "WinRT";
} }
OS::Date OSWinrt::get_date() const { OS::Date OSWinrt::get_date(bool utc) const {
SYSTEMTIME systemtime; SYSTEMTIME systemtime;
GetLocalTime(&systemtime); if (utc)
GetSystemTime(&systemtime);
else
GetLocalTime(&systemtime);
Date date; Date date;
date.day=systemtime.wDay; date.day=systemtime.wDay;
date.month=Month(systemtime.wMonth); date.month=Month(systemtime.wMonth);
@ -485,14 +489,11 @@ OS::TimeZoneInfo OS_Windows::get_time_zone_info() const {
return ret; return ret;
} }
uint64_t OSWinrt::get_unix_time(bool utc) const { uint64_t OSWinrt::get_unix_time() const {
FILETIME ft; FILETIME ft;
SYSTEMTIME st; SYSTEMTIME st;
if (utc) GetSystemTime(&systemtime);
GetSystemTime(&systemtime);
else
GetLocalTime(&systemtime);
SystemTimeToFileTime(&st, &ft); SystemTimeToFileTime(&st, &ft);
SYSTEMTIME ep; SYSTEMTIME ep;

View file

@ -200,6 +200,7 @@ public:
virtual Date get_date(bool utc) const; virtual Date get_date(bool utc) const;
virtual Time get_time(bool utc) const; virtual Time get_time(bool utc) const;
virtual TimeZoneInfo get_time_zone_info() const;
virtual uint64_t get_unix_time() const; virtual uint64_t get_unix_time() const;
virtual bool can_draw() const; virtual bool can_draw() const;