| OLD | NEW |
| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 // Returns true if this object has not been initialized. | 485 // Returns true if this object has not been initialized. |
| 486 bool is_null() const { | 486 bool is_null() const { |
| 487 return ticks_ == 0; | 487 return ticks_ == 0; |
| 488 } | 488 } |
| 489 | 489 |
| 490 // Returns the internal numeric value of the TimeTicks object. | 490 // Returns the internal numeric value of the TimeTicks object. |
| 491 int64 ToInternalValue() const { | 491 int64 ToInternalValue() const { |
| 492 return ticks_; | 492 return ticks_; |
| 493 } | 493 } |
| 494 | 494 |
| 495 // Converts an integer value representing TimeTicks to a class. This is used |
| 496 // when deserializing a |TimeTicks| structure, using a value that originated |
| 497 // from |TimeTicks::ToInternalValue()|. It is not provided as a constructor |
| 498 // because the integer type may be unclear from the perspective of a caller. |
| 499 static TimeTicks FromInternalValue(int64 ticks) { |
| 500 return TimeTicks(ticks); |
| 501 } |
| 502 |
| 495 TimeTicks& operator=(TimeTicks other) { | 503 TimeTicks& operator=(TimeTicks other) { |
| 496 ticks_ = other.ticks_; | 504 ticks_ = other.ticks_; |
| 497 return *this; | 505 return *this; |
| 498 } | 506 } |
| 499 | 507 |
| 500 // Compute the difference between two times. | 508 // Compute the difference between two times. |
| 501 TimeDelta operator-(TimeTicks other) const { | 509 TimeDelta operator-(TimeTicks other) const { |
| 502 return TimeDelta(ticks_ - other.ticks_); | 510 return TimeDelta(ticks_ - other.ticks_); |
| 503 } | 511 } |
| 504 | 512 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 #endif | 565 #endif |
| 558 }; | 566 }; |
| 559 | 567 |
| 560 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 568 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 561 return TimeTicks(t.ticks_ + delta_); | 569 return TimeTicks(t.ticks_ + delta_); |
| 562 } | 570 } |
| 563 | 571 |
| 564 } // namespace base | 572 } // namespace base |
| 565 | 573 |
| 566 #endif // BASE_TIME_H_ | 574 #endif // BASE_TIME_H_ |
| OLD | NEW |