mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
util: Implement ParseISO8601DateTime based on C++20
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2021-2022 The Bitcoin Core developers
|
||||
// Copyright (c) 2021-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -34,8 +34,8 @@ CAmount ConsumeMoney(FuzzedDataProvider& fuzzed_data_provider, const std::option
|
||||
int64_t ConsumeTime(FuzzedDataProvider& fuzzed_data_provider, const std::optional<int64_t>& min, const std::optional<int64_t>& max) noexcept
|
||||
{
|
||||
// Avoid t=0 (1970-01-01T00:00:00Z) since SetMockTime(0) disables mocktime.
|
||||
static const int64_t time_min{946684801}; // 2000-01-01T00:00:01Z
|
||||
static const int64_t time_max{4133980799}; // 2100-12-31T23:59:59Z
|
||||
static const int64_t time_min{ParseISO8601DateTime("2000-01-01T00:00:01Z").value()};
|
||||
static const int64_t time_max{ParseISO8601DateTime("2100-12-31T23:59:59Z").value()};
|
||||
return fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(min.value_or(time_min), max.value_or(time_max));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user