Переглянути джерело

Merge pull request #2042 from est31/fix-win

Fix windows compilability
Juan Linietsky 10 роки тому
батько
коміт
a30b2bf5df

+ 4 - 17
platform/windows/os_windows.cpp

@@ -1829,13 +1829,14 @@ String OS_Windows::get_name() {
 	return "Windows";
 }
 
-OS::Date OS_Windows::get_date() const {
+OS::Date OS_Windows::get_date(bool utc) const {
 
 	SYSTEMTIME systemtime;
-	if (local)
+	if (utc)
 		GetSystemTime(&systemtime);
 	else
 		GetLocalTime(&systemtime);
+
 	Date date;
 	date.day=systemtime.wDay;
 	date.month=Month(systemtime.wMonth);
@@ -1858,20 +1859,6 @@ 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;
@@ -1889,7 +1876,7 @@ OS::TimeZoneInfo OS_Windows::get_time_zone_info() const {
 	return ret;
 }
 
-uint64_t OS_Windows::get_unix_time(bool local) const {
+uint64_t OS_Windows::get_unix_time() const {
 
 	FILETIME ft;
 	SYSTEMTIME st;

+ 1 - 0
platform/windows/os_windows.h

@@ -261,6 +261,7 @@ public:
 	
 	virtual Date get_date(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 bool can_draw() const;

+ 8 - 7
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;
-	GetLocalTime(&systemtime);
+	if (utc)
+		GetSystemTime(&systemtime);
+	else
+		GetLocalTime(&systemtime);
+
 	Date date;
 	date.day=systemtime.wDay;
 	date.month=Month(systemtime.wMonth);
@@ -485,14 +489,11 @@ OS::TimeZoneInfo OS_Windows::get_time_zone_info() const {
 	return ret;
 }
 
-uint64_t OSWinrt::get_unix_time(bool utc) const {
+uint64_t OSWinrt::get_unix_time() const {
 
 	FILETIME ft;
 	SYSTEMTIME st;
-	if (utc)
-		GetSystemTime(&systemtime);
-	else
-		GetLocalTime(&systemtime);
+	GetSystemTime(&systemtime);
 	SystemTimeToFileTime(&st, &ft);
 
 	SYSTEMTIME ep;

+ 1 - 0
platform/winrt/os_winrt.h

@@ -200,6 +200,7 @@ public:
 	
 	virtual Date get_date(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 bool can_draw() const;