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

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

Issue 2870223003: Avoid base::Time::FromJavaTime() when not dealing with Java. (Closed)
Patch Set: Created 3 years, 7 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) 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 coordinated universal time (UTC), 5 // Time represents an absolute point in coordinated universal time (UTC),
6 // internally represented as microseconds (s/1,000,000) since the Windows epoch 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch
7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are 7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are
8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump 8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump
9 // around as the operating system makes adjustments to synchronize (e.g., with 9 // around as the operating system makes adjustments to synchronize (e.g., with
10 // NTP servers). Thus, client code that uses the Time class must account for 10 // NTP servers). Thus, client code that uses the Time class must account for
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // Converts the timespec structure to time. MacOS X 10.8.3 (and tentatively, 485 // Converts the timespec structure to time. MacOS X 10.8.3 (and tentatively,
486 // earlier versions) will have the |ts|'s tv_nsec component zeroed out, 486 // earlier versions) will have the |ts|'s tv_nsec component zeroed out,
487 // having a 1 second resolution, which agrees with 487 // having a 1 second resolution, which agrees with
488 // https://developer.apple.com/legacy/library/#technotes/tn/tn1150.html#HFSPlu sDates. 488 // https://developer.apple.com/legacy/library/#technotes/tn/tn1150.html#HFSPlu sDates.
489 static Time FromTimeSpec(const timespec& ts); 489 static Time FromTimeSpec(const timespec& ts);
490 #endif 490 #endif
491 491
492 // Converts to/from the Javascript convention for times, a number of 492 // Converts to/from the Javascript convention for times, a number of
493 // milliseconds since the epoch: 493 // milliseconds since the epoch:
494 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/g etTime. 494 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/g etTime.
495 // Consider only using this when dealing with Javascript, and using
miu 2017/05/10 21:43:02 Actually, I'm trying to eliminate all uses of From
496 // FromInternalValue()/ToInternalValue() for serialization.
495 static Time FromJsTime(double ms_since_epoch); 497 static Time FromJsTime(double ms_since_epoch);
496 double ToJsTime() const; 498 double ToJsTime() const;
497 499
498 // Converts to/from Java convention for times, a number of 500 // Converts to/from Java convention for times, a number of
499 // milliseconds since the epoch. 501 // milliseconds since the epoch.
502 // Consider only using this when dealing with Java, and using
503 // FromInternalValue()/ToInternalValue() for serialization.
500 static Time FromJavaTime(int64_t ms_since_epoch); 504 static Time FromJavaTime(int64_t ms_since_epoch);
501 int64_t ToJavaTime() const; 505 int64_t ToJavaTime() const;
502 506
503 #if defined(OS_POSIX) 507 #if defined(OS_POSIX)
504 static Time FromTimeVal(struct timeval t); 508 static Time FromTimeVal(struct timeval t);
505 struct timeval ToTimeVal() const; 509 struct timeval ToTimeVal() const;
506 #endif 510 #endif
507 511
508 #if defined(OS_MACOSX) 512 #if defined(OS_MACOSX)
509 static Time FromCFAbsoluteTime(CFAbsoluteTime t); 513 static Time FromCFAbsoluteTime(CFAbsoluteTime t);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 static void WaitUntilInitializedWin(); 848 static void WaitUntilInitializedWin();
845 #endif 849 #endif
846 }; 850 };
847 851
848 // For logging use only. 852 // For logging use only.
849 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); 853 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks);
850 854
851 } // namespace base 855 } // namespace base
852 856
853 #endif // BASE_TIME_TIME_H_ 857 #endif // BASE_TIME_TIME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698