summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-06-06 03:40:56 +0200
committerest31 <MTest31@outlook.com>2015-06-06 05:55:28 +0200
commit803069886ebca492c0d5f47133ccf7833c716e5a (patch)
tree711fbad4ba24fe58c7284e177a16bea6adc9eef5 /platform/windows
parent26ea12a873d0e7c1467ee6b52c9559dc5f456bd3 (diff)
Add utc param to get_time and get_date methods
If utc == false, we return the local time, like before. Otherwise, we return UTC time. utc defaults to false to not break behaviour.
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/os_windows.cpp14
-rw-r--r--platform/windows/os_windows.h4
2 files changed, 12 insertions, 6 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 4bf4fea845..16b9e9b327 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;
- GetLocalTime(&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;
@@ -1853,7 +1859,7 @@ OS::Time OS_Windows::get_time() const {
return time;
}
-uint64_t OS_Windows::get_unix_time() const {
+uint64_t OS_Windows::get_unix_time(bool local) const {
FILETIME ft;
SYSTEMTIME st;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 64fbbf23c0..6b2eb19a76 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -259,8 +259,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;