Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: src/animator/SkTime.cpp

Issue 1420923003: Revert of SkTime::GetNSecs() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkTime.h ('k') | src/core/SkTime.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include "SkTime.h" 8 #include "SkTime.h"
9 9
10 #ifdef SK_BUILD_FOR_WIN 10 #ifdef SK_BUILD_FOR_WIN
(...skipping 10 matching lines...) Expand all
21 t->fYear = SkToU16(syst.wYear); 21 t->fYear = SkToU16(syst.wYear);
22 t->fMonth = SkToU8(syst.wMonth); 22 t->fMonth = SkToU8(syst.wMonth);
23 t->fDayOfWeek = SkToU8(syst.wDayOfWeek); 23 t->fDayOfWeek = SkToU8(syst.wDayOfWeek);
24 t->fDay = SkToU8(syst.wDay); 24 t->fDay = SkToU8(syst.wDay);
25 t->fHour = SkToU8(syst.wHour); 25 t->fHour = SkToU8(syst.wHour);
26 t->fMinute = SkToU8(syst.wMinute); 26 t->fMinute = SkToU8(syst.wMinute);
27 t->fSecond = SkToU8(syst.wSecond); 27 t->fSecond = SkToU8(syst.wSecond);
28 } 28 }
29 } 29 }
30 30
31 SkMSec SkTime::GetMSecs() {
32 #ifdef SK_DEBUG
33 if (gForceTickCount != (SkMSec) -1) {
34 return gForceTickCount;
35 }
36 #endif
37 return ::GetTickCount();
38 }
39
31 #elif defined(xSK_BUILD_FOR_MAC) 40 #elif defined(xSK_BUILD_FOR_MAC)
32 41
33 #include <time.h> 42 #include <time.h>
34 43
35 void SkTime::GetDateTime(DateTime* t) { 44 void SkTime::GetDateTime(DateTime* t) {
36 if (t) { 45 if (t) {
37 tm syst; 46 tm syst;
38 time_t tm; 47 time_t tm;
39 48
40 time(&tm); 49 time(&tm);
41 localtime_r(&tm, &syst); 50 localtime_r(&tm, &syst);
42 t->fYear = SkToU16(syst.tm_year); 51 t->fYear = SkToU16(syst.tm_year);
43 t->fMonth = SkToU8(syst.tm_mon + 1); 52 t->fMonth = SkToU8(syst.tm_mon + 1);
44 t->fDayOfWeek = SkToU8(syst.tm_wday); 53 t->fDayOfWeek = SkToU8(syst.tm_wday);
45 t->fDay = SkToU8(syst.tm_mday); 54 t->fDay = SkToU8(syst.tm_mday);
46 t->fHour = SkToU8(syst.tm_hour); 55 t->fHour = SkToU8(syst.tm_hour);
47 t->fMinute = SkToU8(syst.tm_min); 56 t->fMinute = SkToU8(syst.tm_min);
48 t->fSecond = SkToU8(syst.tm_sec); 57 t->fSecond = SkToU8(syst.tm_sec);
49 } 58 }
50 } 59 }
51 60
61 SkMSec SkTime::GetMSecs() {
62 UnsignedWide wide;
63 ::Microseconds(&wide);
64
65 int64_t s = ((int64_t)wide.hi << 32) | wide.lo;
66 s = (s + 500) / 1000; // rounded divide
67 return (SkMSec)s;
68 }
69
52 #endif 70 #endif
OLDNEW
« no previous file with comments | « include/core/SkTime.h ('k') | src/core/SkTime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698