mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 03:45:50 +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 <cstdint>
 | 
			
		||||
#include <ctime>
 | 
			
		||||
#include <iomanip>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <stdexcept>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <string_view>
 | 
			
		||||
 
 | 
			
		||||
@@ -27,13 +27,13 @@
 | 
			
		||||
#include <boost/json/conversion.hpp>
 | 
			
		||||
#include <boost/json/object.hpp>
 | 
			
		||||
#include <boost/json/value.hpp>
 | 
			
		||||
#include <xrpl/basics/chrono.h>
 | 
			
		||||
#include <xrpl/basics/strHex.h>
 | 
			
		||||
#include <xrpl/protocol/jss.h>
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
#include <ranges>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
namespace rpc {
 | 
			
		||||
 
 | 
			
		||||
@@ -19,13 +19,19 @@
 | 
			
		||||
 | 
			
		||||
#include "util/TimeUtils.hpp"
 | 
			
		||||
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <xrpl/basics/chrono.h>
 | 
			
		||||
 | 
			
		||||
#include <chrono>
 | 
			
		||||
#include <ctime>
 | 
			
		||||
#include <optional>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
namespace util {
 | 
			
		||||
[[nodiscard]] std::optional<std::chrono::system_clock::time_point>
 | 
			
		||||
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);
 | 
			
		||||
    if (ret == nullptr) {
 | 
			
		||||
        return std::nullopt;
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,6 @@
 | 
			
		||||
#include <optional>
 | 
			
		||||
#include <stdexcept>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <string_view>
 | 
			
		||||
#include <utility>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,6 @@
 | 
			
		||||
#include <boost/json/parse.hpp>
 | 
			
		||||
#include <gmock/gmock.h>
 | 
			
		||||
#include <gtest/gtest.h>
 | 
			
		||||
#include <xrpl/protocol/ErrorCodes.h>
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <optional>
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@
 | 
			
		||||
#include <boost/json/value.hpp>
 | 
			
		||||
#include <gmock/gmock.h>
 | 
			
		||||
#include <gtest/gtest.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
#include <string>
 | 
			
		||||
 
 | 
			
		||||
@@ -20,13 +20,17 @@
 | 
			
		||||
#include "util/TimeUtils.hpp"
 | 
			
		||||
 | 
			
		||||
#include <gtest/gtest.h>
 | 
			
		||||
#include <xrpl/basics/chrono.h>
 | 
			
		||||
 | 
			
		||||
#include <chrono>
 | 
			
		||||
#include <ctime>
 | 
			
		||||
 | 
			
		||||
TEST(TimeUtilTests, SystemTpFromUTCStrSuccess)
 | 
			
		||||
{
 | 
			
		||||
    auto const tp = util::SystemTpFromUTCStr("2024-01-01T10:50:40Z", "%Y-%m-%dT%H:%M:%SZ");
 | 
			
		||||
    ASSERT_TRUE(tp.has_value());
 | 
			
		||||
    auto const time = std::chrono::system_clock::to_time_t(tp.value());
 | 
			
		||||
    std::tm timeStruct;
 | 
			
		||||
    std::tm timeStruct{};
 | 
			
		||||
    gmtime_r(&time, &timeStruct);
 | 
			
		||||
    EXPECT_EQ(timeStruct.tm_year + 1900, 2024);
 | 
			
		||||
    EXPECT_EQ(timeStruct.tm_mon, 0);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user