mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Format timestamps using ISO 8601 formatting (e.g. "2018-02-28T12:34:56Z")
* Z is the zone designator for the zero UTC offset. * T is the delimiter used to separate date and time. This makes it clear for the end-user that the date/time logged is specified in UTC and not in the local time zone.
This commit is contained in:
@@ -28,10 +28,6 @@
|
||||
#include <univalue.h>
|
||||
|
||||
|
||||
std::string static EncodeDumpTime(int64_t nTime) {
|
||||
return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime);
|
||||
}
|
||||
|
||||
int64_t static DecodeDumpTime(const std::string &str) {
|
||||
static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t(0);
|
||||
static const std::locale loc(std::locale::classic(),
|
||||
@@ -722,9 +718,9 @@ UniValue dumpwallet(const JSONRPCRequest& request)
|
||||
|
||||
// produce output
|
||||
file << strprintf("# Wallet dump created by Bitcoin %s\n", CLIENT_BUILD);
|
||||
file << strprintf("# * Created on %s\n", EncodeDumpTime(GetTime()));
|
||||
file << strprintf("# * Created on %s\n", FormatISO8601DateTime(GetTime()));
|
||||
file << strprintf("# * Best block at time of backup was %i (%s),\n", chainActive.Height(), chainActive.Tip()->GetBlockHash().ToString());
|
||||
file << strprintf("# mined on %s\n", EncodeDumpTime(chainActive.Tip()->GetBlockTime()));
|
||||
file << strprintf("# mined on %s\n", FormatISO8601DateTime(chainActive.Tip()->GetBlockTime()));
|
||||
file << "\n";
|
||||
|
||||
// add the base58check encoded extended master if the wallet uses HD
|
||||
@@ -741,7 +737,7 @@ UniValue dumpwallet(const JSONRPCRequest& request)
|
||||
}
|
||||
for (std::vector<std::pair<int64_t, CKeyID> >::const_iterator it = vKeyBirth.begin(); it != vKeyBirth.end(); it++) {
|
||||
const CKeyID &keyid = it->second;
|
||||
std::string strTime = EncodeDumpTime(it->first);
|
||||
std::string strTime = FormatISO8601DateTime(it->first);
|
||||
std::string strAddr;
|
||||
std::string strLabel;
|
||||
CKey key;
|
||||
@@ -769,7 +765,7 @@ UniValue dumpwallet(const JSONRPCRequest& request)
|
||||
// get birth times for scripts with metadata
|
||||
auto it = pwallet->m_script_metadata.find(scriptid);
|
||||
if (it != pwallet->m_script_metadata.end()) {
|
||||
create_time = EncodeDumpTime(it->second.nCreateTime);
|
||||
create_time = FormatISO8601DateTime(it->second.nCreateTime);
|
||||
}
|
||||
if(pwallet->GetCScript(scriptid, script)) {
|
||||
file << strprintf("%s %s script=1", HexStr(script.begin(), script.end()), create_time);
|
||||
|
||||
Reference in New Issue
Block a user