Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show All 37 Lines | static int64_t DecodeDumpTime(const std::string &str) { | ||||
boost::posix_time::ptime ptime(boost::date_time::not_a_date_time); | boost::posix_time::ptime ptime(boost::date_time::not_a_date_time); | ||||
iss >> ptime; | iss >> ptime; | ||||
if (ptime.is_not_a_date_time()) return 0; | if (ptime.is_not_a_date_time()) return 0; | ||||
return (ptime - epoch).total_seconds(); | return (ptime - epoch).total_seconds(); | ||||
} | } | ||||
static std::string EncodeDumpString(const std::string &str) { | static std::string EncodeDumpString(const std::string &str) { | ||||
std::stringstream ret; | std::stringstream ret; | ||||
for (uint8_t c : str) { | for (const uint8_t c : str) { | ||||
if (c <= 32 || c >= 128 || c == '%') { | if (c <= 32 || c >= 128 || c == '%') { | ||||
ret << '%' << HexStr(&c, &c + 1); | ret << '%' << HexStr(&c, &c + 1); | ||||
} else { | } else { | ||||
ret << c; | ret << c; | ||||
} | } | ||||
} | } | ||||
return ret.str(); | return ret.str(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,470 Lines • Show Last 20 Lines |