summaryrefslogtreecommitdiff
path: root/src/dcp_time.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-11 23:59:19 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-11 23:59:19 +0100
commit4de8f0118e1baf31cf4c859881dfbf39014b566f (patch)
tree91be88947914d05ff942cbefff6c71eab187cc3c /src/dcp_time.cc
parent3390da35584709ea0626ec1fefd3bf5d797bcc00 (diff)
Use raw_convert instead of boost::lexical_cast as it seems
that lexical_cast will sometimes use a thousands separator (i.e. it will convert 1234 to a string 1,234). It appears not to be possible safely to turn this off (you have to set the global locale). Instead, raw_convert uses a stringstream which you can imbue() with std::locale::classic() to turn off the locale-specific behaviour.
Diffstat (limited to 'src/dcp_time.cc')
-rw-r--r--src/dcp_time.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc
index 14155fdb..d597e3dc 100644
--- a/src/dcp_time.cc
+++ b/src/dcp_time.cc
@@ -24,10 +24,10 @@
#include <iostream>
#include <vector>
#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
#include <cmath>
#include "dcp_time.h"
#include "exceptions.h"
+#include "raw_convert.h"
using namespace std;
using namespace boost;
@@ -78,10 +78,10 @@ Time::Time (string time)
boost::throw_exception (DCPReadError ("unrecognised time specification"));
}
- h = lexical_cast<int> (b[0]);
- m = lexical_cast<int> (b[1]);
- s = lexical_cast<int> (b[2]);
- t = lexical_cast<int> (b[3]);
+ h = raw_convert<int> (b[0]);
+ m = raw_convert<int> (b[1]);
+ s = raw_convert<int> (b[2]);
+ t = raw_convert<int> (b[3]);
}
bool