mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 20:05:51 +00:00
style: clang-tidy auto fixes (#1528)
Fixes #1527. Please review and commit clang-tidy fixes. Co-authored-by: kuznetsss <kuznetsss@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
46bd67a9ec
commit
e85f6cd9e4
@@ -36,8 +36,6 @@
|
|||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iomanip>
|
|
||||||
#include <sstream>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|||||||
@@ -27,13 +27,13 @@
|
|||||||
#include <boost/json/conversion.hpp>
|
#include <boost/json/conversion.hpp>
|
||||||
#include <boost/json/object.hpp>
|
#include <boost/json/object.hpp>
|
||||||
#include <boost/json/value.hpp>
|
#include <boost/json/value.hpp>
|
||||||
|
#include <xrpl/basics/chrono.h>
|
||||||
#include <xrpl/basics/strHex.h>
|
#include <xrpl/basics/strHex.h>
|
||||||
#include <xrpl/protocol/jss.h>
|
#include <xrpl/protocol/jss.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace rpc {
|
namespace rpc {
|
||||||
|
|||||||
@@ -19,13 +19,19 @@
|
|||||||
|
|
||||||
#include "util/TimeUtils.hpp"
|
#include "util/TimeUtils.hpp"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
#include <xrpl/basics/chrono.h>
|
#include <xrpl/basics/chrono.h>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <ctime>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
[[nodiscard]] std::optional<std::chrono::system_clock::time_point>
|
[[nodiscard]] std::optional<std::chrono::system_clock::time_point>
|
||||||
SystemTpFromUTCStr(std::string const& dateStr, std::string const& format)
|
SystemTpFromUTCStr(std::string const& dateStr, std::string const& format)
|
||||||
{
|
{
|
||||||
std::tm timeStruct;
|
std::tm timeStruct{};
|
||||||
auto const ret = strptime(dateStr.c_str(), format.c_str(), &timeStruct);
|
auto const ret = strptime(dateStr.c_str(), format.c_str(), &timeStruct);
|
||||||
if (ret == nullptr) {
|
if (ret == nullptr) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include <boost/json/parse.hpp>
|
#include <boost/json/parse.hpp>
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <xrpl/protocol/ErrorCodes.h>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <boost/json/value.hpp>
|
#include <boost/json/value.hpp>
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -20,13 +20,17 @@
|
|||||||
#include "util/TimeUtils.hpp"
|
#include "util/TimeUtils.hpp"
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
#include <xrpl/basics/chrono.h>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
TEST(TimeUtilTests, SystemTpFromUTCStrSuccess)
|
TEST(TimeUtilTests, SystemTpFromUTCStrSuccess)
|
||||||
{
|
{
|
||||||
auto const tp = util::SystemTpFromUTCStr("2024-01-01T10:50:40Z", "%Y-%m-%dT%H:%M:%SZ");
|
auto const tp = util::SystemTpFromUTCStr("2024-01-01T10:50:40Z", "%Y-%m-%dT%H:%M:%SZ");
|
||||||
ASSERT_TRUE(tp.has_value());
|
ASSERT_TRUE(tp.has_value());
|
||||||
auto const time = std::chrono::system_clock::to_time_t(tp.value());
|
auto const time = std::chrono::system_clock::to_time_t(tp.value());
|
||||||
std::tm timeStruct;
|
std::tm timeStruct{};
|
||||||
gmtime_r(&time, &timeStruct);
|
gmtime_r(&time, &timeStruct);
|
||||||
EXPECT_EQ(timeStruct.tm_year + 1900, 2024);
|
EXPECT_EQ(timeStruct.tm_year + 1900, 2024);
|
||||||
EXPECT_EQ(timeStruct.tm_mon, 0);
|
EXPECT_EQ(timeStruct.tm_mon, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user