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

Side by Side Diff: base/time/time_win.cc

Issue 1128203010: base: Remove the remaining usage GG_(U)INTn_C macros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« base/time/time_unittest.cc ('K') | « base/time/time_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 18 matching lines...) Expand all
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") 36 #pragma comment(lib, "winmm.lib")
37 #include <windows.h> 37 #include <windows.h>
38 #include <mmsystem.h> 38 #include <mmsystem.h>
39 39
viettrungluu 2015/05/14 21:32:33 ditto
tfarina 2015/05/18 17:09:02 Done.
40 #include "base/basictypes.h" 40 #include "base/basictypes.h"
41 #include "base/cpu.h" 41 #include "base/cpu.h"
42 #include "base/lazy_instance.h" 42 #include "base/lazy_instance.h"
43 #include "base/logging.h" 43 #include "base/logging.h"
44 #include "base/synchronization/lock.h" 44 #include "base/synchronization/lock.h"
45 45
46 using base::Time; 46 using base::Time;
47 using base::TimeDelta; 47 using base::TimeDelta;
48 using base::TimeTicks; 48 using base::TimeTicks;
49 49
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 } // namespace 100 } // namespace
101 101
102 // Time ----------------------------------------------------------------------- 102 // Time -----------------------------------------------------------------------
103 103
104 // The internal representation of Time uses FILETIME, whose epoch is 1601-01-01 104 // The internal representation of Time uses FILETIME, whose epoch is 1601-01-01
105 // 00:00:00 UTC. ((1970-1601)*365+89)*24*60*60*1000*1000, where 89 is the 105 // 00:00:00 UTC. ((1970-1601)*365+89)*24*60*60*1000*1000, where 89 is the
106 // number of leap year days between 1601 and 1970: (1970-1601)/4 excluding 106 // number of leap year days between 1601 and 1970: (1970-1601)/4 excluding
107 // 1700, 1800, and 1900. 107 // 1700, 1800, and 1900.
108 // static 108 // static
109 const int64 Time::kTimeTToMicrosecondsOffset = GG_INT64_C(11644473600000000); 109 const int64 Time::kTimeTToMicrosecondsOffset = INT64_C(11644473600000000);
110 110
111 // static 111 // static
112 Time Time::Now() { 112 Time Time::Now() {
113 if (initial_time == 0) 113 if (initial_time == 0)
114 InitializeClock(); 114 InitializeClock();
115 115
116 // We implement time using the high-resolution timers so that we can get 116 // We implement time using the high-resolution timers so that we can get
117 // timeouts which are smaller than 10-15ms. If we just used 117 // timeouts which are smaller than 10-15ms. If we just used
118 // CurrentWallclockMicroseconds(), we'd have the less-granular timer. 118 // CurrentWallclockMicroseconds(), we'd have the less-granular timer.
119 // 119 //
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 TimeTicks TimeTicks::FromQPCValue(LONGLONG qpc_value) { 518 TimeTicks TimeTicks::FromQPCValue(LONGLONG qpc_value) {
519 return TimeTicks() + QPCValueToTimeDelta(qpc_value); 519 return TimeTicks() + QPCValueToTimeDelta(qpc_value);
520 } 520 }
521 521
522 // TimeDelta ------------------------------------------------------------------ 522 // TimeDelta ------------------------------------------------------------------
523 523
524 // static 524 // static
525 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) { 525 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) {
526 return QPCValueToTimeDelta(qpc_value); 526 return QPCValueToTimeDelta(qpc_value);
527 } 527 }
OLDNEW
« base/time/time_unittest.cc ('K') | « base/time/time_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698