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

Side by Side Diff: base/time/time.h

Issue 34623008: Change to calculate the real NTP in TimeTicks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | base/time/time.cc » ('j') | base/time/time.cc » ('J')
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 // 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 the Windows epoch (1601-01-01 00:00:00 UTC) 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC)
7 // (See http://crbug.com/14734). System-dependent clock interface routines are 7 // (See http://crbug.com/14734). System-dependent clock interface routines are
8 // defined in time_PLATFORM.cc. 8 // 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 597 }
598 598
599 // Converts an integer value representing TimeTicks to a class. This is used 599 // Converts an integer value representing TimeTicks to a class. This is used
600 // when deserializing a |TimeTicks| structure, using a value known to be 600 // when deserializing a |TimeTicks| structure, using a value known to be
601 // compatible. It is not provided as a constructor because the integer type 601 // compatible. It is not provided as a constructor because the integer type
602 // may be unclear from the perspective of a caller. 602 // may be unclear from the perspective of a caller.
603 static TimeTicks FromInternalValue(int64 ticks) { 603 static TimeTicks FromInternalValue(int64 ticks) {
604 return TimeTicks(ticks); 604 return TimeTicks(ticks);
605 } 605 }
606 606
607 // Get the TimeTick value at the time of the UnixEpoch. This is useful when
608 // you need to relate the value of TimeTicks to a real time and date.
609 // Note: this function will return the same value during the duration of
610 // the application; however it might change for next run since your TickClock
miu 2013/10/24 21:48:52 nit: For clarity, I would replace the "Note:" text
pwestin 2013/10/24 22:39:52 Done.
611 // might have a different starting point.
612 static TimeTicks UnixEpoch();
613
607 // Returns the internal numeric value of the TimeTicks object. 614 // Returns the internal numeric value of the TimeTicks object.
608 // For serializing, use FromInternalValue to reconstitute. 615 // For serializing, use FromInternalValue to reconstitute.
609 int64 ToInternalValue() const { 616 int64 ToInternalValue() const {
610 return ticks_; 617 return ticks_;
611 } 618 }
612 619
613 TimeTicks& operator=(TimeTicks other) { 620 TimeTicks& operator=(TimeTicks other) {
614 ticks_ = other.ticks_; 621 ticks_ = other.ticks_;
615 return *this; 622 return *this;
616 } 623 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 #endif 682 #endif
676 }; 683 };
677 684
678 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 685 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
679 return TimeTicks(t.ticks_ + delta_); 686 return TimeTicks(t.ticks_ + delta_);
680 } 687 }
681 688
682 } // namespace base 689 } // namespace base
683 690
684 #endif // BASE_TIME_TIME_H_ 691 #endif // BASE_TIME_TIME_H_
OLDNEW
« no previous file with comments | « no previous file | base/time/time.cc » ('j') | base/time/time.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698