Rename GetIconID to GetIconId
[chromium-blink-merge.git] / components / variations / variations_experiment_util.cc
blob9cf78bbabc0159e0d7088c92d42d05038b81e5fe
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/variations/variations_experiment_util.h"
7 #include <vector>
9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h"
14 namespace variations {
16 const base::char16 kExperimentLabelSeparator = ';';
18 namespace {
20 const char* const kDays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
22 const char* const kMonths[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
23 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
25 } // namespace
27 base::string16 BuildExperimentDateString(const base::Time& current_time) {
28 // The Google Update experiment_labels timestamp format is:
29 // "DAY, DD0 MON YYYY HH0:MI0:SE0 TZ"
30 // DAY = 3 character day of week,
31 // DD0 = 2 digit day of month,
32 // MON = 3 character month of year,
33 // YYYY = 4 digit year,
34 // HH0 = 2 digit hour,
35 // MI0 = 2 digit minute,
36 // SE0 = 2 digit second,
37 // TZ = 3 character timezone
38 base::Time::Exploded then = {};
39 current_time.UTCExplode(&then);
40 then.year += 1;
41 DCHECK(then.HasValidValues());
43 return base::UTF8ToUTF16(
44 base::StringPrintf("%s, %02d %s %d %02d:%02d:%02d GMT",
45 kDays[then.day_of_week],
46 then.day_of_month,
47 kMonths[then.month - 1],
48 then.year,
49 then.hour,
50 then.minute,
51 then.second));
54 } // namespace variations