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

Side by Side Diff: base/time_mac.cc

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename undo/stop to cancel Created 8 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/time.h" 5 #include "base/time.h"
6 6
7 #include <CoreFoundation/CFDate.h> 7 #include <CoreFoundation/CFDate.h>
8 #include <CoreFoundation/CFTimeZone.h> 8 #include <CoreFoundation/CFTimeZone.h>
9 #include <mach/mach_time.h> 9 #include <mach/mach_time.h>
10 #include <sys/sysctl.h> 10 #include <sys/sysctl.h>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const int64 Time::kWindowsEpochDeltaMicroseconds = 92 const int64 Time::kWindowsEpochDeltaMicroseconds =
93 kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond; 93 kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond;
94 94
95 // Some functions in time.cc use time_t directly, so we provide an offset 95 // Some functions in time.cc use time_t directly, so we provide an offset
96 // to convert from time_t (Unix epoch) and internal (Windows epoch). 96 // to convert from time_t (Unix epoch) and internal (Windows epoch).
97 // static 97 // static
98 const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds; 98 const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds;
99 99
100 // static 100 // static
101 Time Time::Now() { 101 Time Time::Now() {
102 if (TimeFactory::instance())
103 return TimeFactory::instance()->TimeNow();
102 return FromCFAbsoluteTime(CFAbsoluteTimeGetCurrent()); 104 return FromCFAbsoluteTime(CFAbsoluteTimeGetCurrent());
103 } 105 }
104 106
105 // static 107 // static
106 Time Time::FromCFAbsoluteTime(CFAbsoluteTime t) { 108 Time Time::FromCFAbsoluteTime(CFAbsoluteTime t) {
107 if (t == 0) 109 if (t == 0)
108 return Time(); // Consider 0 as a null Time. 110 return Time(); // Consider 0 as a null Time.
109 if (t == std::numeric_limits<CFAbsoluteTime>::max()) 111 if (t == std::numeric_limits<CFAbsoluteTime>::max())
110 return Max(); 112 return Max();
111 return Time(static_cast<int64>( 113 return Time(static_cast<int64>(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 exploded->millisecond = 178 exploded->millisecond =
177 (microsecond >= 0) ? microsecond / kMicrosecondsPerMillisecond : 179 (microsecond >= 0) ? microsecond / kMicrosecondsPerMillisecond :
178 (microsecond - kMicrosecondsPerMillisecond + 1) / 180 (microsecond - kMicrosecondsPerMillisecond + 1) /
179 kMicrosecondsPerMillisecond; 181 kMicrosecondsPerMillisecond;
180 } 182 }
181 183
182 // TimeTicks ------------------------------------------------------------------ 184 // TimeTicks ------------------------------------------------------------------
183 185
184 // static 186 // static
185 TimeTicks TimeTicks::Now() { 187 TimeTicks TimeTicks::Now() {
188 if (TimeFactory::instance())
189 return TimeFactory::instance()->TimeTicksNow();
186 return TimeTicks(ComputeCurrentTicks()); 190 return TimeTicks(ComputeCurrentTicks());
187 } 191 }
188 192
189 // static 193 // static
190 TimeTicks TimeTicks::HighResNow() { 194 TimeTicks TimeTicks::HighResNow() {
191 return Now(); 195 return Now();
192 } 196 }
193 197
194 // static 198 // static
195 TimeTicks TimeTicks::NowFromSystemTraceTime() { 199 TimeTicks TimeTicks::NowFromSystemTraceTime() {
196 return HighResNow(); 200 return HighResNow();
197 } 201 }
198 202
199 } // namespace base 203 } // namespace base
OLDNEW
« base/test/scoped_time_controller.cc ('K') | « base/time.cc ('k') | base/time_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698