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

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

Issue 596103002: Fix more disabled MSVC warnings, base/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 6 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 | « base/threading/platform_thread_win.cc ('k') | base/time/time_win.cc » ('j') | no next file with comments »
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 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) (See http://crbug.com/14734). System-dependent 7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent
8 // clock interface routines are defined in time_PLATFORM.cc. 8 // clock interface routines are 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (ms == std::numeric_limits<int64>::max()) 531 if (ms == std::numeric_limits<int64>::max())
532 return Max(); 532 return Max();
533 return TimeDelta(ms * Time::kMicrosecondsPerMillisecond); 533 return TimeDelta(ms * Time::kMicrosecondsPerMillisecond);
534 } 534 }
535 535
536 // static 536 // static
537 inline TimeDelta TimeDelta::FromSecondsD(double secs) { 537 inline TimeDelta TimeDelta::FromSecondsD(double secs) {
538 // Preserve max to prevent overflow. 538 // Preserve max to prevent overflow.
539 if (secs == std::numeric_limits<double>::infinity()) 539 if (secs == std::numeric_limits<double>::infinity())
540 return Max(); 540 return Max();
541 return TimeDelta(secs * Time::kMicrosecondsPerSecond); 541 return TimeDelta(static_cast<int64>(secs * Time::kMicrosecondsPerSecond));
542 } 542 }
543 543
544 // static 544 // static
545 inline TimeDelta TimeDelta::FromMillisecondsD(double ms) { 545 inline TimeDelta TimeDelta::FromMillisecondsD(double ms) {
546 // Preserve max to prevent overflow. 546 // Preserve max to prevent overflow.
547 if (ms == std::numeric_limits<double>::infinity()) 547 if (ms == std::numeric_limits<double>::infinity())
548 return Max(); 548 return Max();
549 return TimeDelta(ms * Time::kMicrosecondsPerMillisecond); 549 return TimeDelta(static_cast<int64>(ms * Time::kMicrosecondsPerMillisecond));
550 } 550 }
551 551
552 // static 552 // static
553 inline TimeDelta TimeDelta::FromMicroseconds(int64 us) { 553 inline TimeDelta TimeDelta::FromMicroseconds(int64 us) {
554 // Preserve max to prevent overflow. 554 // Preserve max to prevent overflow.
555 if (us == std::numeric_limits<int64>::max()) 555 if (us == std::numeric_limits<int64>::max())
556 return Max(); 556 return Max();
557 return TimeDelta(us); 557 return TimeDelta(us);
558 } 558 }
559 559
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 #endif 719 #endif
720 }; 720 };
721 721
722 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 722 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
723 return TimeTicks(t.ticks_ + delta_); 723 return TimeTicks(t.ticks_ + delta_);
724 } 724 }
725 725
726 } // namespace base 726 } // namespace base
727 727
728 #endif // BASE_TIME_TIME_H_ 728 #endif // BASE_TIME_TIME_H_
OLDNEW
« no previous file with comments | « base/threading/platform_thread_win.cc ('k') | base/time/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698