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

Side by Side Diff: base/time.h

Issue 9055001: Change code in base (primarily unit tests) to use Sleep(TimeDelta). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 int64 InMilliseconds() const; 94 int64 InMilliseconds() const;
95 int64 InMillisecondsRoundedUp() const; 95 int64 InMillisecondsRoundedUp() const;
96 int64 InMicroseconds() const; 96 int64 InMicroseconds() const;
97 97
98 TimeDelta& operator=(TimeDelta other) { 98 TimeDelta& operator=(TimeDelta other) {
99 delta_ = other.delta_; 99 delta_ = other.delta_;
100 return *this; 100 return *this;
101 } 101 }
102 102
103 // Computations with other deltas. 103 // Computations with other deltas.
104 TimeDelta operator+(TimeDelta other) const { 104 TimeDelta operator+(const TimeDelta other) const {
brettw 2011/12/31 17:52:06 Why did you change these lines? It seems like it d
105 return TimeDelta(delta_ + other.delta_); 105 return TimeDelta(delta_ + other.delta_);
106 } 106 }
107 TimeDelta operator-(TimeDelta other) const { 107 TimeDelta operator-(const TimeDelta other) const {
108 return TimeDelta(delta_ - other.delta_); 108 return TimeDelta(delta_ - other.delta_);
109 } 109 }
110 110
111 TimeDelta& operator+=(TimeDelta other) { 111 TimeDelta& operator+=(const TimeDelta other) {
112 delta_ += other.delta_; 112 delta_ += other.delta_;
113 return *this; 113 return *this;
114 } 114 }
115 TimeDelta& operator-=(TimeDelta other) { 115 TimeDelta& operator-=(const TimeDelta other) {
116 delta_ -= other.delta_; 116 delta_ -= other.delta_;
117 return *this; 117 return *this;
118 } 118 }
119 TimeDelta operator-() const { 119 TimeDelta operator-() const {
120 return TimeDelta(-delta_); 120 return TimeDelta(-delta_);
121 } 121 }
122 122
123 // Computations with ints, note that we only allow multiplicative operations 123 // Computations with ints, note that we only allow multiplicative operations
124 // with ints, and additive operations with other deltas. 124 // with ints, and additive operations with other deltas.
125 TimeDelta operator*(int64 a) const { 125 TimeDelta operator*(int64 a) const {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 #endif 575 #endif
576 }; 576 };
577 577
578 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 578 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
579 return TimeTicks(t.ticks_ + delta_); 579 return TimeTicks(t.ticks_ + delta_);
580 } 580 }
581 581
582 } // namespace base 582 } // namespace base
583 583
584 #endif // BASE_TIME_H_ 584 #endif // BASE_TIME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698