diff options
Diffstat (limited to 'src/ports/SkTime_win.cpp')
-rw-r--r-- | src/ports/SkTime_win.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ports/SkTime_win.cpp b/src/ports/SkTime_win.cpp index bc0f8f0084..19f4695a86 100644 --- a/src/ports/SkTime_win.cpp +++ b/src/ports/SkTime_win.cpp @@ -14,8 +14,22 @@ void SkTime::GetDateTime(DateTime* dt) if (dt) { SYSTEMTIME st; - GetSystemTime(&st); - + TIME_ZONE_INFORMATION timeZoneInfo; + int tz_bias; + GetLocalTime(&st); + // https://gist.github.com/wrl/8924636 + switch (GetTimeZoneInformation(&timeZoneInfo)) { + case TIME_ZONE_ID_STANDARD: + tz_bias = -timeZoneInfo.Bias - timeZoneInfo.StandardBias; + break; + case TIME_ZONE_ID_DAYLIGHT: + tz_bias = -timeZoneInfo.Bias - timeZoneInfo.DaylightBias; + break; + default: + tz_bias = -timeZoneInfo.Bias; + break; + } + dt->fTimeZoneMinutes = SkToS16(tz_bias); dt->fYear = st.wYear; dt->fMonth = SkToU8(st.wMonth); dt->fDayOfWeek = SkToU8(st.wDayOfWeek); |