OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkOncePtr.h" | 8 #include "SkOncePtr.h" |
9 #include "SkString.h" | 9 #include "SkString.h" |
10 #include "SkTime.h" | 10 #include "SkTime.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 static_cast<unsigned>(fDay), static_cast<unsigned>(fHour), | 21 static_cast<unsigned>(fDay), static_cast<unsigned>(fHour), |
22 static_cast<unsigned>(fMinute), | 22 static_cast<unsigned>(fMinute), |
23 static_cast<unsigned>(fSecond), timezoneSign, timeZoneHours, | 23 static_cast<unsigned>(fSecond), timezoneSign, timeZoneHours, |
24 timeZoneMinutes); | 24 timeZoneMinutes); |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 | 28 |
29 #ifdef SK_BUILD_FOR_WIN32 | 29 #ifdef SK_BUILD_FOR_WIN32 |
30 | 30 |
31 #include "Windows.h" | 31 #include "windows.h" |
32 void SkTime::GetDateTime(DateTime* dt) { | 32 void SkTime::GetDateTime(DateTime* dt) { |
33 if (dt) { | 33 if (dt) { |
34 SYSTEMTIME st; | 34 SYSTEMTIME st; |
35 GetSystemTime(&st); | 35 GetSystemTime(&st); |
36 dt->fTimeZoneMinutes = 0; | 36 dt->fTimeZoneMinutes = 0; |
37 dt->fYear = st.wYear; | 37 dt->fYear = st.wYear; |
38 dt->fMonth = SkToU8(st.wMonth); | 38 dt->fMonth = SkToU8(st.wMonth); |
39 dt->fDayOfWeek = SkToU8(st.wDayOfWeek); | 39 dt->fDayOfWeek = SkToU8(st.wDayOfWeek); |
40 dt->fDay = SkToU8(st.wDay); | 40 dt->fDay = SkToU8(st.wDay); |
41 dt->fHour = SkToU8(st.wHour); | 41 dt->fHour = SkToU8(st.wHour); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #else | 92 #else |
93 // This std::chrono code looks great on Linux and Android, | 93 // This std::chrono code looks great on Linux and Android, |
94 // but MSVC 2013 returned mostly garbage (0ns times, etc). | 94 // but MSVC 2013 returned mostly garbage (0ns times, etc). |
95 #include <chrono> | 95 #include <chrono> |
96 double SkTime::GetNSecs() { | 96 double SkTime::GetNSecs() { |
97 auto now = std::chrono::high_resolution_clock::now(); | 97 auto now = std::chrono::high_resolution_clock::now(); |
98 std::chrono::duration<double, std::nano> ns = now.time_since_epoch(); | 98 std::chrono::duration<double, std::nano> ns = now.time_since_epoch(); |
99 return ns.count(); | 99 return ns.count(); |
100 } | 100 } |
101 #endif | 101 #endif |
OLD | NEW |