comparison base/RealTimeSV.cpp @ 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 b7b84ae5f0a7
children 622d193a00dc
comparison
equal deleted inserted replaced
1297:5cc969b236b0 1298:a1af054d8f75
82 { 82 {
83 RealTime t; 83 RealTime t;
84 84
85 int year = 0, month = 0, day = 0, hour = 0, minute = 0; 85 int year = 0, month = 0, day = 0, hour = 0, minute = 0;
86 double second = 0.0; 86 double second = 0.0;
87
88 char *loc = setlocale(LC_NUMERIC, 0);
89 (void)setlocale(LC_NUMERIC, "C"); // avoid strtod expecting ,-separator in DE
87 90
88 int i = 0; 91 int i = 0;
89 92
90 const char *s = xsdd.c_str(); 93 const char *s = xsdd.c_str();
91 int len = int(xsdd.length()); 94 int len = int(xsdd.length());
149 t = t + RealTime(minute * 60, 0); 152 t = t + RealTime(minute * 60, 0);
150 } 153 }
151 154
152 t = t + fromSeconds(second); 155 t = t + fromSeconds(second);
153 156
157 setlocale(LC_NUMERIC, loc);
158
154 if (negative) { 159 if (negative) {
155 return -t; 160 return -t;
156 } else { 161 } else {
157 return t; 162 return t;
158 } 163 }