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 | 5 |
6 // Windows Timer Primer | 6 // Windows Timer Primer |
7 // | 7 // |
8 // A good article: http://www.ddj.com/windows/184416651 | 8 // A good article: http://www.ddj.com/windows/184416651 |
9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258 | 9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258 |
10 // | 10 // |
(...skipping 15 matching lines...) Expand all Loading... |
26 // faster multimedia timers can hurt battery life. See the intel | 26 // faster multimedia timers can hurt battery life. See the intel |
27 // article about this here: | 27 // article about this here: |
28 // http://softwarecommunity.intel.com/articles/eng/1086.htm | 28 // http://softwarecommunity.intel.com/articles/eng/1086.htm |
29 // | 29 // |
30 // To work around all this, we're going to generally use timeGetTime(). We | 30 // To work around all this, we're going to generally use timeGetTime(). We |
31 // will only increase the system-wide timer if we're not running on battery | 31 // will only increase the system-wide timer if we're not running on battery |
32 // power. | 32 // power. |
33 | 33 |
34 #include "base/time/time.h" | 34 #include "base/time/time.h" |
35 | 35 |
36 #pragma comment(lib, "winmm.lib") | |
37 #include <windows.h> | 36 #include <windows.h> |
38 #include <mmsystem.h> | 37 #include <mmsystem.h> |
39 #include <stdint.h> | 38 #include <stdint.h> |
40 | 39 |
41 #include "base/bit_cast.h" | 40 #include "base/bit_cast.h" |
42 #include "base/cpu.h" | 41 #include "base/cpu.h" |
43 #include "base/lazy_instance.h" | 42 #include "base/lazy_instance.h" |
44 #include "base/logging.h" | 43 #include "base/logging.h" |
45 #include "base/synchronization/lock.h" | 44 #include "base/synchronization/lock.h" |
46 | 45 |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 TimeTicks TimeTicks::FromQPCValue(LONGLONG qpc_value) { | 606 TimeTicks TimeTicks::FromQPCValue(LONGLONG qpc_value) { |
608 return TimeTicks() + QPCValueToTimeDelta(qpc_value); | 607 return TimeTicks() + QPCValueToTimeDelta(qpc_value); |
609 } | 608 } |
610 | 609 |
611 // TimeDelta ------------------------------------------------------------------ | 610 // TimeDelta ------------------------------------------------------------------ |
612 | 611 |
613 // static | 612 // static |
614 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) { | 613 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) { |
615 return QPCValueToTimeDelta(qpc_value); | 614 return QPCValueToTimeDelta(qpc_value); |
616 } | 615 } |
OLD | NEW |