OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // Returns the internal numeric value of the TimeDelta object. Please don't | 58 // Returns the internal numeric value of the TimeDelta object. Please don't |
59 // use this and do arithmetic on it, as it is more error prone than using the | 59 // use this and do arithmetic on it, as it is more error prone than using the |
60 // provided operators. | 60 // provided operators. |
61 int64 ToInternalValue() const { | 61 int64 ToInternalValue() const { |
62 return delta_; | 62 return delta_; |
63 } | 63 } |
64 | 64 |
65 // Returns the time delta in some unit. The F versions return a floating | 65 // Returns the time delta in some unit. The F versions return a floating |
66 // point value, the "regular" versions return a rounded-down value. | 66 // point value, the "regular" versions return a rounded-down value. |
| 67 // |
| 68 // InMillisecondsRoundedUp() instead returns an integer that is rounded up |
| 69 // to the next full millisecond. |
67 int InDays() const; | 70 int InDays() const; |
68 int InHours() const; | 71 int InHours() const; |
69 int InMinutes() const; | 72 int InMinutes() const; |
70 double InSecondsF() const; | 73 double InSecondsF() const; |
71 int64 InSeconds() const; | 74 int64 InSeconds() const; |
72 double InMillisecondsF() const; | 75 double InMillisecondsF() const; |
73 int64 InMilliseconds() const; | 76 int64 InMilliseconds() const; |
| 77 int64 InMillisecondsRoundedUp() const; |
74 int64 InMicroseconds() const; | 78 int64 InMicroseconds() const; |
75 | 79 |
76 TimeDelta& operator=(TimeDelta other) { | 80 TimeDelta& operator=(TimeDelta other) { |
77 delta_ = other.delta_; | 81 delta_ = other.delta_; |
78 return *this; | 82 return *this; |
79 } | 83 } |
80 | 84 |
81 // Computations with other deltas. | 85 // Computations with other deltas. |
82 TimeDelta operator+(TimeDelta other) const { | 86 TimeDelta operator+(TimeDelta other) const { |
83 return TimeDelta(delta_ + other.delta_); | 87 return TimeDelta(delta_ + other.delta_); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 #endif | 495 #endif |
492 }; | 496 }; |
493 | 497 |
494 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 498 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
495 return TimeTicks(t.ticks_ + delta_); | 499 return TimeTicks(t.ticks_ + delta_); |
496 } | 500 } |
497 | 501 |
498 } // namespace base | 502 } // namespace base |
499 | 503 |
500 #endif // BASE_TIME_H_ | 504 #endif // BASE_TIME_H_ |
OLD | NEW |