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

Side by Side Diff: base/time/time.h

Issue 446203002: Initialize the now_funciton to the HighResNowWrapper in case High Res is supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit fixes Created 6 years, 4 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
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 // Time represents an absolute point in coordinated universal time (UTC), 5 // Time represents an absolute point in coordinated universal time (UTC),
6 // internally represented as microseconds (s/1,000,000) since the Windows epoch 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch
7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent 7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent
8 // clock interface routines are defined in time_PLATFORM.cc. 8 // clock interface routines are 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 #if defined(OS_WIN) 632 #if defined(OS_WIN)
633 // Get the absolute value of QPC time drift. For testing. 633 // Get the absolute value of QPC time drift. For testing.
634 static int64 GetQPCDriftMicroseconds(); 634 static int64 GetQPCDriftMicroseconds();
635 635
636 static TimeTicks FromQPCValue(LONGLONG qpc_value); 636 static TimeTicks FromQPCValue(LONGLONG qpc_value);
637 637
638 // Returns true if the high resolution clock is working on this system. 638 // Returns true if the high resolution clock is working on this system.
639 // This is only for testing. 639 // This is only for testing.
640 static bool IsHighResClockWorking(); 640 static bool IsHighResClockWorking();
641 641
642 // Enable high resolution time for TimeTicks::Now(). This function will
643 // test for the availability of a working implementation of
644 // QueryPerformanceCounter(). If one is not available, this function does
645 // nothing and the resolution of Now() remains 1ms. Otherwise, all future
646 // calls to TimeTicks::Now() will have the higher resolution provided by QPC.
647 // Returns true if high resolution time was successfully enabled.
648 static bool SetNowIsHighResNowIfSupported();
649
650 // Returns a time value that is NOT rollover protected. 642 // Returns a time value that is NOT rollover protected.
651 static TimeTicks UnprotectedNow(); 643 static TimeTicks UnprotectedNow();
652 #endif 644 #endif
653 645
654 // Returns true if this object has not been initialized. 646 // Returns true if this object has not been initialized.
655 bool is_null() const { 647 bool is_null() const {
656 return ticks_ == 0; 648 return ticks_ == 0;
657 } 649 }
658 650
659 // Converts an integer value representing TimeTicks to a class. This is used 651 // Converts an integer value representing TimeTicks to a class. This is used
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 #endif 735 #endif
744 }; 736 };
745 737
746 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 738 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
747 return TimeTicks(t.ticks_ + delta_); 739 return TimeTicks(t.ticks_ + delta_);
748 } 740 }
749 741
750 } // namespace base 742 } // namespace base
751 743
752 #endif // BASE_TIME_TIME_H_ 744 #endif // BASE_TIME_TIME_H_
OLDNEW
« no previous file with comments | « base/test/test_suite.cc ('k') | base/time/time_win.cc » ('j') | base/time/time_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698