| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 | |
| 8 #include "SkTime.h" | |
| 9 | |
| 10 #ifdef SK_BUILD_FOR_WIN | |
| 11 | |
| 12 #ifdef SK_DEBUG | |
| 13 SkMSec gForceTickCount = (SkMSec) -1; | |
| 14 #endif | |
| 15 | |
| 16 void SkTime::GetDateTime(DateTime* t) { | |
| 17 if (t) { | |
| 18 SYSTEMTIME syst; | |
| 19 | |
| 20 ::GetLocalTime(&syst); | |
| 21 t->fYear = SkToU16(syst.wYear); | |
| 22 t->fMonth = SkToU8(syst.wMonth); | |
| 23 t->fDayOfWeek = SkToU8(syst.wDayOfWeek); | |
| 24 t->fDay = SkToU8(syst.wDay); | |
| 25 t->fHour = SkToU8(syst.wHour); | |
| 26 t->fMinute = SkToU8(syst.wMinute); | |
| 27 t->fSecond = SkToU8(syst.wSecond); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 #elif defined(xSK_BUILD_FOR_MAC) | |
| 32 | |
| 33 #include <time.h> | |
| 34 | |
| 35 void SkTime::GetDateTime(DateTime* t) { | |
| 36 if (t) { | |
| 37 tm syst; | |
| 38 time_t tm; | |
| 39 | |
| 40 time(&tm); | |
| 41 localtime_r(&tm, &syst); | |
| 42 t->fYear = SkToU16(syst.tm_year); | |
| 43 t->fMonth = SkToU8(syst.tm_mon + 1); | |
| 44 t->fDayOfWeek = SkToU8(syst.tm_wday); | |
| 45 t->fDay = SkToU8(syst.tm_mday); | |
| 46 t->fHour = SkToU8(syst.tm_hour); | |
| 47 t->fMinute = SkToU8(syst.tm_min); | |
| 48 t->fSecond = SkToU8(syst.tm_sec); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 #endif | |
| OLD | NEW |