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

Unified Diff: base/time.cc

Issue 6903022: Removed wchar_t from Time::FromString (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/time.h ('k') | base/time_unittest.cc » ('j') | base/time_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time.cc
diff --git a/base/time.cc b/base/time.cc
index 766f599fc05f1299e340d0ca73e62fcfa471e711..76539adcd963c0bff25587f9b7004566eb0b5baa 100644
--- a/base/time.cc
+++ b/base/time.cc
@@ -98,20 +98,32 @@ Time Time::LocalMidnight() const {
}
// static
-bool Time::FromString(const wchar_t* time_string, Time* parsed_time) {
+bool Time::FromString(const char* time_string, Time* parsed_time) {
DCHECK((time_string != NULL) && (parsed_time != NULL));
- std::string ascii_time_string = SysWideToUTF8(time_string);
- if (ascii_time_string.length() == 0)
+
+ if (time_string[0] == '\0') {
brettw 2011/04/26 15:33:03 Be consistent about {} usage for single-line condi
return false;
+ }
+
PRTime result_time = 0;
- PRStatus result = PR_ParseTimeString(ascii_time_string.c_str(), PR_FALSE,
+ PRStatus result = PR_ParseTimeString(time_string, PR_FALSE,
&result_time);
if (PR_SUCCESS != result)
return false;
result_time += kTimeTToMicrosecondsOffset;
*parsed_time = Time(result_time);
return true;
+
+}
+
+#if 0
brettw 2011/04/26 15:33:03 Why is this here commented out?
+// static
+bool Time::FromString(const wchar_t* time_string, Time* parsed_time) {
+ DCHECK((time_string != NULL) && (parsed_time != NULL));
+ std::string ascii_time_string = SysWideToUTF8(time_string);
+ return FromString(ascii_time_string.c_str(), parsed_time);
}
+#endif
// Time::Exploded -------------------------------------------------------------
« no previous file with comments | « base/time.h ('k') | base/time_unittest.cc » ('j') | base/time_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698