Merge pull request #3691

a143d4c Fix crash in importwallet and dumpwallet formatting (Wladimir J. van der Laan)
This commit is contained in:
Wladimir J. van der Laan 2014-02-17 18:44:06 +01:00
commit 0a0cf14337
No known key found for this signature in database
GPG key ID: 74810B012346C9A6

View file

@ -23,13 +23,13 @@ using namespace std;
void EnsureWalletIsUnlocked(); void EnsureWalletIsUnlocked();
std::string static EncodeDumpTime(int64_t nTime) { std::string static EncodeDumpTime(int64_t nTime) {
return DateTimeStrFormat("%Y-%m-%"PRId64"T%H:%M:%SZ", nTime); return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime);
} }
int64_t static DecodeDumpTime(const std::string &str) { int64_t static DecodeDumpTime(const std::string &str) {
static boost::posix_time::time_input_facet facet("%Y-%m-%dT%H:%M:%SZ");
static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t(0); static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t(0);
const std::locale loc(std::locale::classic(), &facet); static const std::locale loc(std::locale::classic(),
new boost::posix_time::time_input_facet("%Y-%m-%dT%H:%M:%SZ"));
std::istringstream iss(str); std::istringstream iss(str);
iss.imbue(loc); iss.imbue(loc);
boost::posix_time::ptime ptime(boost::date_time::not_a_date_time); boost::posix_time::ptime ptime(boost::date_time::not_a_date_time);