michael@0: michael@0: /* michael@0: * Copyright 2009 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #include "SkTime.h" michael@0: michael@0: void SkTime::GetDateTime(DateTime* dt) michael@0: { michael@0: if (dt) michael@0: { michael@0: SYSTEMTIME st; michael@0: GetSystemTime(&st); michael@0: michael@0: dt->fYear = st.wYear; michael@0: dt->fMonth = SkToU8(st.wMonth + 1); michael@0: dt->fDayOfWeek = SkToU8(st.wDayOfWeek); michael@0: dt->fDay = SkToU8(st.wDay); michael@0: dt->fHour = SkToU8(st.wHour); michael@0: dt->fMinute = SkToU8(st.wMinute); michael@0: dt->fSecond = SkToU8(st.wSecond); michael@0: } michael@0: } michael@0: michael@0: SkMSec SkTime::GetMSecs() michael@0: { michael@0: FILETIME ft; michael@0: LARGE_INTEGER li; michael@0: GetSystemTimeAsFileTime(&ft); michael@0: li.LowPart = ft.dwLowDateTime; michael@0: li.HighPart = ft.dwHighDateTime; michael@0: __int64 t = li.QuadPart; /* In 100-nanosecond intervals */ michael@0: return (SkMSec)(t / 10000); /* In milliseconds */ michael@0: }