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 "chrome/installer/util/google_update_experiment_util.h"
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 google_update
{
17 const wchar_t kExperimentLabels
[] = L
"experiment_labels";
20 const base::char16 kExperimentLabelSeparator
= ';';
22 } // namespace google_update
28 const char* const kDays
[] =
29 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
31 const char* const kMonths
[] =
32 { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
37 base::string16
BuildExperimentDateString(const base::Time
& current_time
) {
38 // The Google Update experiment_labels timestamp format is:
39 // "DAY, DD0 MON YYYY HH0:MI0:SE0 TZ"
40 // DAY = 3 character day of week,
41 // DD0 = 2 digit day of month,
42 // MON = 3 character month of year,
43 // YYYY = 4 digit year,
44 // HH0 = 2 digit hour,
45 // MI0 = 2 digit minute,
46 // SE0 = 2 digit second,
47 // TZ = 3 character timezone
48 base::Time::Exploded then
= {};
49 current_time
.UTCExplode(&then
);
51 DCHECK(then
.HasValidValues());
53 return base::UTF8ToUTF16(
54 base::StringPrintf("%s, %02d %s %d %02d:%02d:%02d GMT",
55 kDays
[then
.day_of_week
],
57 kMonths
[then
.month
- 1],
64 } // namespace installer