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

Side by Side Diff: include/core/SkTime.h

Issue 1562943002: SkTime: Stop using POSIX entensions to time.h for timezone (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-01-11 (Monday) 17:28:49 EST Created 4 years, 11 months 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 | « no previous file | src/animator/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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkTime_DEFINED 10 #ifndef SkTime_DEFINED
(...skipping 20 matching lines...) Expand all
31 uint8_t fSecond; //!< 0..59 31 uint8_t fSecond; //!< 0..59
32 32
33 void toISO8601(SkString* dst) const; 33 void toISO8601(SkString* dst) const;
34 }; 34 };
35 static void GetDateTime(DateTime*); 35 static void GetDateTime(DateTime*);
36 36
37 static SkMSec GetMSecs() { return (SkMSec)(GetNSecs() * 1e-6); } 37 static SkMSec GetMSecs() { return (SkMSec)(GetNSecs() * 1e-6); }
38 static double GetNSecs(); 38 static double GetNSecs();
39 }; 39 };
40 40
41 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_WIN32)
42 extern SkMSec gForceTickCount;
43 #endif
44
45 #define SK_TIME_FACTOR 1 41 #define SK_TIME_FACTOR 1
46 42
47 /////////////////////////////////////////////////////////////////////////////// 43 ///////////////////////////////////////////////////////////////////////////////
48 44
49 class SkAutoTime { 45 class SkAutoTime {
50 public: 46 public:
51 // The label is not deep-copied, so its address must remain valid for the 47 // The label is not deep-copied, so its address must remain valid for the
52 // lifetime of this object 48 // lifetime of this object
53 SkAutoTime(const char* label = NULL, SkMSec minToDump = 0) : fLabel(label) 49 SkAutoTime(const char* label = NULL, SkMSec minToDump = 0) : fLabel(label)
54 { 50 {
55 fNow = SkTime::GetMSecs(); 51 fNow = SkTime::GetMSecs();
56 fMinToDump = minToDump; 52 fMinToDump = minToDump;
57 } 53 }
58 ~SkAutoTime() 54 ~SkAutoTime()
59 { 55 {
60 SkMSec dur = SkTime::GetMSecs() - fNow; 56 SkMSec dur = SkTime::GetMSecs() - fNow;
61 if (dur >= fMinToDump) { 57 if (dur >= fMinToDump) {
62 SkDebugf("%s %d\n", fLabel ? fLabel : "", dur); 58 SkDebugf("%s %d\n", fLabel ? fLabel : "", dur);
63 } 59 }
64 } 60 }
65 private: 61 private:
66 const char* fLabel; 62 const char* fLabel;
67 SkMSec fNow; 63 SkMSec fNow;
68 SkMSec fMinToDump; 64 SkMSec fMinToDump;
69 }; 65 };
70 #define SkAutoTime(...) SK_REQUIRE_LOCAL_VAR(SkAutoTime) 66 #define SkAutoTime(...) SK_REQUIRE_LOCAL_VAR(SkAutoTime)
71 67
72 #endif 68 #endif
OLDNEW
« no previous file with comments | « no previous file | src/animator/SkTime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698