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

Unified Diff: src/inspector/string-16.cc

Issue 2410933002: [inspector] fix timestamp formatting with non C locales (Closed)
Patch Set: better test Created 4 years, 2 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
Index: src/inspector/string-16.cc
diff --git a/src/inspector/string-16.cc b/src/inspector/string-16.cc
index e39b87c17f8f035201e9ea4b4835ea3da6c52800..429ce3b5cfa5d7241fa3efe61649538d4d93e2fb 100644
--- a/src/inspector/string-16.cc
+++ b/src/inspector/string-16.cc
@@ -388,6 +388,17 @@ String16 String16::fromDouble(double number) {
}
// static
+String16 String16::fromDoubleForcePointAsSeparator(double number) {
+ const size_t kBufferSize = 100;
+ char buffer[kBufferSize];
+ std::string prev_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
+ v8::base::OS::SNPrintF(buffer, kBufferSize, "%f", number);
+ setlocale(LC_NUMERIC, prev_locale.c_str());
+ return String16(buffer);
+}
+
+// static
String16 String16::fromDoublePrecision3(double number) {
const size_t kBufferSize = 100;
char buffer[kBufferSize];

Powered by Google App Engine
This is Rietveld 408576698