OLD | NEW |
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 #ifndef CHROME_BROWSER_GOOGLE_APIS_TIME_UTIL_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_TIME_UTIL_H_ |
6 #define CHROME_BROWSER_GOOGLE_APIS_TIME_UTIL_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_TIME_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
11 | 11 |
12 class FilePath; | |
13 class Profile; | 12 class Profile; |
14 | 13 |
15 namespace base { | 14 namespace base { |
16 class Time; | 15 class Time; |
17 } // namespace base | 16 } // namespace base |
18 | 17 |
19 namespace google_apis { | 18 namespace google_apis { |
20 namespace util { | 19 namespace util { |
21 | 20 |
22 // Parses an RFC 3339 date/time into a base::Time, returning true on success. | 21 // Parses an RFC 3339 date/time into a base::Time, returning true on success. |
23 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is | 22 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is |
24 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string). | 23 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string). |
25 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); | 24 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); |
26 | 25 |
27 // Formats a base::Time as an RFC 3339 date/time (in UTC). | 26 // Formats a base::Time as an RFC 3339 date/time (in UTC). |
28 std::string FormatTimeAsString(const base::Time& time); | 27 std::string FormatTimeAsString(const base::Time& time); |
29 // Formats a base::Time as an RFC 3339 date/time (in localtime). | 28 // Formats a base::Time as an RFC 3339 date/time (in localtime). |
30 std::string FormatTimeAsStringLocaltime(const base::Time& time); | 29 std::string FormatTimeAsStringLocaltime(const base::Time& time); |
31 | 30 |
32 } // namespace util | 31 } // namespace util |
33 } // namespace google_apis | 32 } // namespace google_apis |
34 | 33 |
35 #endif // CHROME_BROWSER_GOOGLE_APIS_TIME_UTIL_H_ | 34 #endif // CHROME_BROWSER_GOOGLE_APIS_TIME_UTIL_H_ |
OLD | NEW |