changeset 1298:a1af054d8f75 3.0-integration

Avoid being locale-specific in XSD parse
author Chris Cannam
date Fri, 25 Nov 2016 14:26:24 +0000
parents 5cc969b236b0
children 838a45cff62d
files base/RealTimeSV.cpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/base/RealTimeSV.cpp	Fri Nov 25 11:37:06 2016 +0000
+++ b/base/RealTimeSV.cpp	Fri Nov 25 14:26:24 2016 +0000
@@ -85,6 +85,9 @@
     int year = 0, month = 0, day = 0, hour = 0, minute = 0;
     double second = 0.0;
 
+    char *loc = setlocale(LC_NUMERIC, 0);
+    (void)setlocale(LC_NUMERIC, "C"); // avoid strtod expecting ,-separator in DE
+
     int i = 0;
 
     const char *s = xsdd.c_str();
@@ -151,6 +154,8 @@
 
     t = t + fromSeconds(second);
 
+    setlocale(LC_NUMERIC, loc);
+    
     if (negative) {
         return -t;
     } else {