Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Unified Diff: src/ports/SkTime_win.cpp

Issue 1109593002: SkTime: return timezone information (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reorder assignment Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkTime_Unix.cpp ('k') | tests/Time.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkTime_win.cpp
diff --git a/src/ports/SkTime_win.cpp b/src/ports/SkTime_win.cpp
index bc0f8f008474bcfef45280d417863891cfc39eb8..19f4695a86bc498c76cb1d81d26e69e63ea70348 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);
« no previous file with comments | « src/ports/SkTime_Unix.cpp ('k') | tests/Time.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698