OLD | NEW |
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 // 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 the Windows epoch (1601-01-01 00:00:00 UTC) | 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) |
7 // (See http://crbug.com/14734). System-dependent clock interface routines are | 7 // (See http://crbug.com/14734). System-dependent clock interface routines are |
8 // defined in time_PLATFORM.cc. | 8 // 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 #if defined(OS_WIN) | 631 #if defined(OS_WIN) |
632 typedef DWORD (*TickFunctionType)(void); | 632 typedef DWORD (*TickFunctionType)(void); |
633 static TickFunctionType SetMockTickFunction(TickFunctionType ticker); | 633 static TickFunctionType SetMockTickFunction(TickFunctionType ticker); |
634 #endif | 634 #endif |
635 }; | 635 }; |
636 | 636 |
637 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 637 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
638 return TimeTicks(t.ticks_ + delta_); | 638 return TimeTicks(t.ticks_ + delta_); |
639 } | 639 } |
640 | 640 |
| 641 // TimeFactory ---------------------------------------------------------------- |
| 642 |
| 643 class BASE_EXPORT TimeFactory { |
| 644 public: |
| 645 virtual Time TimeNow() = 0; |
| 646 virtual TimeTicks TimeTicksNow() = 0; |
| 647 virtual TimeTicks TimeTicksHighResNow() = 0; |
| 648 |
| 649 static TimeFactory* instance() { return instance_; } |
| 650 |
| 651 protected: |
| 652 static TimeFactory* instance_; |
| 653 }; |
| 654 |
641 } // namespace base | 655 } // namespace base |
642 | 656 |
643 #endif // BASE_TIME_H_ | 657 #endif // BASE_TIME_H_ |
OLD | NEW |