From ae025b25ce38c1dbeb1c3a98724c51463ab3af08 Mon Sep 17 00:00:00 2001 From: NH Date: Sun, 19 Oct 2025 14:22:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=87=E4=BB=B6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=94=B9=E4=B8=BAC++17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/net/http_response.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/net/http_response.cpp b/src/net/http_response.cpp index de61b43..86a6c28 100644 --- a/src/net/http_response.cpp +++ b/src/net/http_response.cpp @@ -164,8 +164,13 @@ bool ylib::network::http::response::send_file(const std::string& filepath, int32 }*/ { auto filesize = std::filesystem::file_size(filepath2); - auto ftime =std::filesystem::last_write_time(filepath2); - auto sctp = std::chrono::clock_cast(ftime); + auto ftime = std::filesystem::last_write_time(filepath2); + // 把 file_time_type 转为 system_clock::time_point + auto sctp = std::chrono::time_point_cast( + ftime - decltype(ftime)::clock::now() + std::chrono::system_clock::now() + ); + + // 转为 time_t(UNIX 时间戳) last_modify_time = std::chrono::system_clock::to_time_t(sctp); } // 设置为已发送