OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Time represents an absolute point in time, internally represented as | 5 // Time represents an absolute point in time, internally represented as |
6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each | 6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each |
7 // platform's epoch, along with other system-dependent clock interface | 7 // platform's epoch, along with other system-dependent clock interface |
8 // routines, is defined in time_PLATFORM.cc. | 8 // routines, is defined in time_PLATFORM.cc. |
9 // | 9 // |
10 // TimeDelta represents a duration of time, internally represented in | 10 // TimeDelta represents a duration of time, internally represented in |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // Converts time to/from a double which is the number of seconds since epoch | 235 // Converts time to/from a double which is the number of seconds since epoch |
236 // (Jan 1, 1970). Webkit uses this format to represent time. | 236 // (Jan 1, 1970). Webkit uses this format to represent time. |
237 static Time FromDoubleT(double dt); | 237 static Time FromDoubleT(double dt); |
238 double ToDoubleT() const; | 238 double ToDoubleT() const; |
239 | 239 |
240 | 240 |
241 #if defined(OS_WIN) | 241 #if defined(OS_WIN) |
242 static Time FromFileTime(FILETIME ft); | 242 static Time FromFileTime(FILETIME ft); |
243 FILETIME ToFileTime() const; | 243 FILETIME ToFileTime() const; |
244 | 244 |
245 // Monitor system power state and disable high resolution timer when we're | 245 // Enable or disable Windows high resolution timer. For more details |
246 // on battery. See time_win.cc for more details. | 246 // see comments in time_win.cc. Returns true on success. |
247 static void StartSystemMonitorObserver(); | 247 static bool UseHighResolutionTimer(bool use); |
248 | |
249 // Enable high resolution timer unconditionally. Only for test code. | |
250 static void EnableHiResClockForTests(); | |
251 #endif | 248 #endif |
252 | 249 |
253 // Converts an exploded structure representing either the local time or UTC | 250 // Converts an exploded structure representing either the local time or UTC |
254 // into a Time class. | 251 // into a Time class. |
255 static Time FromUTCExploded(const Exploded& exploded) { | 252 static Time FromUTCExploded(const Exploded& exploded) { |
256 return FromExploded(false, exploded); | 253 return FromExploded(false, exploded); |
257 } | 254 } |
258 static Time FromLocalExploded(const Exploded& exploded) { | 255 static Time FromLocalExploded(const Exploded& exploded) { |
259 return FromExploded(true, exploded); | 256 return FromExploded(true, exploded); |
260 } | 257 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 #endif | 492 #endif |
496 }; | 493 }; |
497 | 494 |
498 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 495 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
499 return TimeTicks(t.ticks_ + delta_); | 496 return TimeTicks(t.ticks_ + delta_); |
500 } | 497 } |
501 | 498 |
502 } // namespace base | 499 } // namespace base |
503 | 500 |
504 #endif // BASE_TIME_H_ | 501 #endif // BASE_TIME_H_ |
OLD | NEW |