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

Side by Side Diff: base/metrics/field_trial.cc

Issue 2086393003: Make callers of FromUTC(Local)Exploded in base/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/i18n/time_formatting_unittest.cc ('k') | base/test/test_reg_util_win_unittest.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 #include "base/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 26 matching lines...) Expand all
37 37
38 Time::Exploded exploded; 38 Time::Exploded exploded;
39 exploded.year = year; 39 exploded.year = year;
40 exploded.month = month; 40 exploded.month = month;
41 exploded.day_of_week = 0; // Should be unused. 41 exploded.day_of_week = 0; // Should be unused.
42 exploded.day_of_month = day_of_month; 42 exploded.day_of_month = day_of_month;
43 exploded.hour = 0; 43 exploded.hour = 0;
44 exploded.minute = 0; 44 exploded.minute = 0;
45 exploded.second = 0; 45 exploded.second = 0;
46 exploded.millisecond = 0; 46 exploded.millisecond = 0;
47 Time out_time;
48 if (!Time::FromLocalExploded(exploded, &out_time)) {
49 // TODO(maksims): implement failure handling.
50 // We might just return |out_time|, which is Time(0).
51 NOTIMPLEMENTED();
52 }
47 53
48 return Time::FromLocalExploded(exploded); 54 return out_time;
49 } 55 }
50 56
51 // Returns the boundary value for comparing against the FieldTrial's added 57 // Returns the boundary value for comparing against the FieldTrial's added
52 // groups for a given |divisor| (total probability) and |entropy_value|. 58 // groups for a given |divisor| (total probability) and |entropy_value|.
53 FieldTrial::Probability GetGroupBoundaryValue( 59 FieldTrial::Probability GetGroupBoundaryValue(
54 FieldTrial::Probability divisor, 60 FieldTrial::Probability divisor,
55 double entropy_value) { 61 double entropy_value) {
56 // Add a tiny epsilon value to get consistent results when converting floating 62 // Add a tiny epsilon value to get consistent results when converting floating
57 // points to int. Without it, boundary values have inconsistent results, e.g.: 63 // points to int. Without it, boundary values have inconsistent results, e.g.:
58 // 64 //
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 return; 649 return;
644 } 650 }
645 AutoLock auto_lock(global_->lock_); 651 AutoLock auto_lock(global_->lock_);
646 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); 652 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name();
647 trial->AddRef(); 653 trial->AddRef();
648 trial->SetTrialRegistered(); 654 trial->SetTrialRegistered();
649 global_->registered_[trial->trial_name()] = trial; 655 global_->registered_[trial->trial_name()] = trial;
650 } 656 }
651 657
652 } // namespace base 658 } // namespace base
OLDNEW
« no previous file with comments | « base/i18n/time_formatting_unittest.cc ('k') | base/test/test_reg_util_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698