OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 // Please use Now() to create a new object. This is for internal use | 430 // Please use Now() to create a new object. This is for internal use |
431 // and testing. Ticks is in microseconds. | 431 // and testing. Ticks is in microseconds. |
432 explicit TimeTicks(int64 ticks) : ticks_(ticks) { | 432 explicit TimeTicks(int64 ticks) : ticks_(ticks) { |
433 } | 433 } |
434 | 434 |
435 // Tick count in microseconds. | 435 // Tick count in microseconds. |
436 int64 ticks_; | 436 int64 ticks_; |
437 | 437 |
438 #if defined(OS_WIN) | 438 #if defined(OS_WIN) |
439 // The function to use for counting ticks. | 439 typedef DWORD (__stdcall *TickFunctionType)(void); |
440 typedef int (__stdcall *TickFunction)(void); | 440 static TickFunctionType SetMockTickFunction(TickFunctionType ticker); |
441 static TickFunction tick_function_; | |
442 #endif | 441 #endif |
443 }; | 442 }; |
444 | 443 |
445 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 444 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
446 return TimeTicks(t.ticks_ + delta_); | 445 return TimeTicks(t.ticks_ + delta_); |
447 } | 446 } |
448 | 447 |
449 #endif // BASE_TIME_H_ | 448 #endif // BASE_TIME_H_ |
450 | 449 |
OLD | NEW |