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

Side by Side Diff: src/ports/SkTime_win.cpp

Issue 1562943002: SkTime: Stop using POSIX entensions to time.h for timezone (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-01-11 (Monday) 17:28:49 EST Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/ports/SkTime_Unix.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2009 The Android Open Source Project 3 * Copyright 2009 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_WIN32)
10 8
11
12 #include "SkTime.h"
13
14 void SkTime::GetDateTime(DateTime* dt)
15 {
16 if (dt)
17 {
18 SYSTEMTIME st;
19 TIME_ZONE_INFORMATION timeZoneInfo;
20 int tz_bias;
21 GetLocalTime(&st);
22 // https://gist.github.com/wrl/8924636
23 switch (GetTimeZoneInformation(&timeZoneInfo)) {
24 case TIME_ZONE_ID_STANDARD:
25 tz_bias = -timeZoneInfo.Bias - timeZoneInfo.StandardBias;
26 break;
27 case TIME_ZONE_ID_DAYLIGHT:
28 tz_bias = -timeZoneInfo.Bias - timeZoneInfo.DaylightBias;
29 break;
30 default:
31 tz_bias = -timeZoneInfo.Bias;
32 break;
33 }
34 dt->fTimeZoneMinutes = SkToS16(tz_bias);
35 dt->fYear = st.wYear;
36 dt->fMonth = SkToU8(st.wMonth);
37 dt->fDayOfWeek = SkToU8(st.wDayOfWeek);
38 dt->fDay = SkToU8(st.wDay);
39 dt->fHour = SkToU8(st.wHour);
40 dt->fMinute = SkToU8(st.wMinute);
41 dt->fSecond = SkToU8(st.wSecond);
42 }
43 }
44 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/ports/SkTime_Unix.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698