OLD | NEW |
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) | |
OLD | NEW |