23
23
#include < tuple>
24
24
25
25
#include < boost/algorithm/string.hpp>
26
- #include < boost/date_time/posix_time/posix_time.hpp>
27
26
28
27
#include < univalue.h>
29
28
30
29
31
- int64_t static DecodeDumpTime (const std::string &str) {
32
- static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t (0 );
33
- static const std::locale loc (std::locale::classic (),
34
- new boost::posix_time::time_input_facet (" %Y-%m-%dT%H:%M:%SZ" ));
35
- std::istringstream iss (str);
36
- iss.imbue (loc);
37
- boost::posix_time::ptime ptime (boost::date_time::not_a_date_time);
38
- iss >> ptime;
39
- if (ptime.is_not_a_date_time ())
40
- return 0 ;
41
- return (ptime - epoch).total_seconds ();
42
- }
43
30
44
31
std::string static EncodeDumpString (const std::string &str) {
45
32
std::stringstream ret;
@@ -598,7 +585,7 @@ UniValue importwallet(const JSONRPCRequest& request)
598
585
continue ;
599
586
CKey key = DecodeSecret (vstr[0 ]);
600
587
if (key.IsValid ()) {
601
- int64_t nTime = DecodeDumpTime (vstr[1 ]);
588
+ int64_t nTime = ParseISO8601DateTime (vstr[1 ]);
602
589
std::string strLabel;
603
590
bool fLabel = true ;
604
591
for (unsigned int nStr = 2 ; nStr < vstr.size (); nStr++) {
@@ -617,7 +604,7 @@ UniValue importwallet(const JSONRPCRequest& request)
617
604
} else if (IsHex (vstr[0 ])) {
618
605
std::vector<unsigned char > vData (ParseHex (vstr[0 ]));
619
606
CScript script = CScript (vData.begin (), vData.end ());
620
- int64_t birth_time = DecodeDumpTime (vstr[1 ]);
607
+ int64_t birth_time = ParseISO8601DateTime (vstr[1 ]);
621
608
scripts.push_back (std::pair<CScript, int64_t >(script, birth_time));
622
609
}
623
610
}
0 commit comments