gfx/skia/trunk/src/ports/SkTime_win.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/ports/SkTime_win.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2009 The Android Open Source Project
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#include "SkTime.h"
    1.14 +
    1.15 +void SkTime::GetDateTime(DateTime* dt)
    1.16 +{
    1.17 +    if (dt)
    1.18 +    {
    1.19 +        SYSTEMTIME      st;
    1.20 +        GetSystemTime(&st);
    1.21 +
    1.22 +        dt->fYear       = st.wYear;
    1.23 +        dt->fMonth      = SkToU8(st.wMonth + 1);
    1.24 +        dt->fDayOfWeek  = SkToU8(st.wDayOfWeek);
    1.25 +        dt->fDay        = SkToU8(st.wDay);
    1.26 +        dt->fHour       = SkToU8(st.wHour);
    1.27 +        dt->fMinute     = SkToU8(st.wMinute);
    1.28 +        dt->fSecond     = SkToU8(st.wSecond);
    1.29 +    }
    1.30 +}
    1.31 +
    1.32 +SkMSec SkTime::GetMSecs()
    1.33 +{
    1.34 +    FILETIME        ft;
    1.35 +    LARGE_INTEGER   li;
    1.36 +    GetSystemTimeAsFileTime(&ft);
    1.37 +    li.LowPart  = ft.dwLowDateTime;
    1.38 +    li.HighPart = ft.dwHighDateTime;
    1.39 +    __int64 t  = li.QuadPart;       /* In 100-nanosecond intervals */
    1.40 +    return (SkMSec)(t / 10000);               /* In milliseconds */
    1.41 +}

mercurial