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

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

Issue 1782053004: Change how the quota system computes the total poolsize for temporary storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 10 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/time/time.h ('k') | chrome/browser/BUILD.gn » ('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 #include "base/time/time.h" 5 #include "base/time/time.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <ios> 8 #include <ios>
9 #include <limits> 9 #include <limits>
10 #include <ostream> 10 #include <ostream>
11 #include <sstream> 11 #include <sstream>
12 12
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/third_party/nspr/prtime.h" 17 #include "base/third_party/nspr/prtime.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 19
20 namespace base { 20 namespace base {
21 21
22 // TimeDelta ------------------------------------------------------------------ 22 // TimeDelta ------------------------------------------------------------------
23 23
24 // static
25 TimeDelta TimeDelta::Max() {
26 return TimeDelta(std::numeric_limits<int64_t>::max());
27 }
28
29 int TimeDelta::InDays() const { 24 int TimeDelta::InDays() const {
30 if (is_max()) { 25 if (is_max()) {
31 // Preserve max to prevent overflow. 26 // Preserve max to prevent overflow.
32 return std::numeric_limits<int>::max(); 27 return std::numeric_limits<int>::max();
33 } 28 }
34 return static_cast<int>(delta_ / Time::kMicrosecondsPerDay); 29 return static_cast<int>(delta_ / Time::kMicrosecondsPerDay);
35 } 30 }
36 31
37 int TimeDelta::InHours() const { 32 int TimeDelta::InHours() const {
38 if (is_max()) { 33 if (is_max()) {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 return is_in_range(month, 1, 12) && 342 return is_in_range(month, 1, 12) &&
348 is_in_range(day_of_week, 0, 6) && 343 is_in_range(day_of_week, 0, 6) &&
349 is_in_range(day_of_month, 1, 31) && 344 is_in_range(day_of_month, 1, 31) &&
350 is_in_range(hour, 0, 23) && 345 is_in_range(hour, 0, 23) &&
351 is_in_range(minute, 0, 59) && 346 is_in_range(minute, 0, 59) &&
352 is_in_range(second, 0, 60) && 347 is_in_range(second, 0, 60) &&
353 is_in_range(millisecond, 0, 999); 348 is_in_range(millisecond, 0, 999);
354 } 349 }
355 350
356 } // namespace base 351 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time.h ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698