mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 19:22:17 +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:
10
src/util.cpp
10
src/util.cpp
@@ -315,12 +315,14 @@ static std::string LogTimestampStr(const std::string &str, std::atomic_bool *fSt
|
||||
|
||||
if (*fStartedNewLine) {
|
||||
int64_t nTimeMicros = GetTimeMicros();
|
||||
strStamped = DateTimeStrFormat("%Y-%m-%d %H:%M:%S", nTimeMicros/1000000);
|
||||
if (fLogTimeMicros)
|
||||
strStamped += strprintf(".%06d", nTimeMicros%1000000);
|
||||
strStamped = FormatISO8601DateTime(nTimeMicros/1000000);
|
||||
if (fLogTimeMicros) {
|
||||
strStamped.pop_back();
|
||||
strStamped += strprintf(".%06dZ", nTimeMicros%1000000);
|
||||
}
|
||||
int64_t mocktime = GetMockTime();
|
||||
if (mocktime) {
|
||||
strStamped += " (mocktime: " + DateTimeStrFormat("%Y-%m-%d %H:%M:%S", mocktime) + ")";
|
||||
strStamped += " (mocktime: " + FormatISO8601DateTime(mocktime) + ")";
|
||||
}
|
||||
strStamped += ' ' + str;
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user