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.
This commit is contained in:
est31
2015-06-06 03:40:56 +02:00
parent 26ea12a873
commit 803069886e
11 changed files with 62 additions and 35 deletions

View File

@ -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;