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 // 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 } | 74 } |
75 | 75 |
76 // Returns the internal numeric value of the TimeDelta object. Please don't | 76 // Returns the internal numeric value of the TimeDelta object. Please don't |
77 // use this and do arithmetic on it, as it is more error prone than using the | 77 // use this and do arithmetic on it, as it is more error prone than using the |
78 // provided operators. | 78 // provided operators. |
79 // For serializing, use FromInternalValue to reconstitute. | 79 // For serializing, use FromInternalValue to reconstitute. |
80 int64 ToInternalValue() const { | 80 int64 ToInternalValue() const { |
81 return delta_; | 81 return delta_; |
82 } | 82 } |
83 | 83 |
84 // Returns true if this object has not been initialized. | |
85 bool is_null() const { | |
Yoyo Zhou
2012/07/31 09:57:32
I'm not sure this is right. A delta of 0 could act
Devlin
2012/07/31 16:43:40
Oooh, good point. I was wondering why there wasn't
| |
86 return delta_ == 0; | |
87 } | |
88 | |
84 #if defined(OS_POSIX) | 89 #if defined(OS_POSIX) |
85 struct timespec ToTimeSpec() const; | 90 struct timespec ToTimeSpec() const; |
86 #endif | 91 #endif |
87 | 92 |
88 // Returns the time delta in some unit. The F versions return a floating | 93 // Returns the time delta in some unit. The F versions return a floating |
89 // point value, the "regular" versions return a rounded-down value. | 94 // point value, the "regular" versions return a rounded-down value. |
90 // | 95 // |
91 // InMillisecondsRoundedUp() instead returns an integer that is rounded up | 96 // InMillisecondsRoundedUp() instead returns an integer that is rounded up |
92 // to the next full millisecond. | 97 // to the next full millisecond. |
93 int InDays() const; | 98 int InDays() const; |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 #endif | 604 #endif |
600 }; | 605 }; |
601 | 606 |
602 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 607 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
603 return TimeTicks(t.ticks_ + delta_); | 608 return TimeTicks(t.ticks_ + delta_); |
604 } | 609 } |
605 | 610 |
606 } // namespace base | 611 } // namespace base |
607 | 612 |
608 #endif // BASE_TIME_H_ | 613 #endif // BASE_TIME_H_ |
OLD | NEW |