From a6fd9633ff6589df2812e0233482ee173d60935b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Sun, 24 Nov 2024 12:25:54 +0100 Subject: [PATCH] wip --- .pkg | 2 +- .pkg.lock | 4 ++-- include/motis/parse_location.h | 3 --- src/parse_location.cc | 26 -------------------------- test/read_test.cc | 5 ----- 5 files changed, 3 insertions(+), 37 deletions(-) diff --git a/.pkg b/.pkg index 1ba232325..abe108946 100644 --- a/.pkg +++ b/.pkg @@ -17,7 +17,7 @@ [adr] url=git@github.com:triptix-tech/adr.git branch=master - commit=bd3bb6bb8f1b5c0e066acd975767df27d5de22f8 + commit=28365ed6b64b804296a09cb19cf8527247687f04 [googletest] url=git@github.com:motis-project/googletest.git branch=master diff --git a/.pkg.lock b/.pkg.lock index 2e42d6894..a28854c7c 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,4 +1,4 @@ -5061172279391244024 +18178785441693657313 cista 847b27100b7e730370b810ce62206a66b0bf2d79 zlib-ng 68ab3e2d80253ec5dc3c83691d9ff70477b32cd3 boost 930f38eb0365ceb7853273e03da4d9e7787abfb9 @@ -46,5 +46,5 @@ reflect-cpp c54fe66de4650b60c23aadd4a06d9db4ffeda22f FTXUI dd6a5d371fd7a3e2937bb579955003c54b727233 tg 20c0f298b8ce58de29a790290f44dca7c4ecc364 utf8proc 779b780da3b99d123133eb99707b65c7e4324cc8 -adr bd3bb6bb8f1b5c0e066acd975767df27d5de22f8 +adr 28365ed6b64b804296a09cb19cf8527247687f04 openapi-cpp 6b5fd40a2b552fc5656aeff56f203a34c1d9e9af diff --git a/include/motis/parse_location.h b/include/motis/parse_location.h index 6c254bac4..d927a6fec 100644 --- a/include/motis/parse_location.h +++ b/include/motis/parse_location.h @@ -14,9 +14,6 @@ namespace motis { std::optional parse_location(std::string_view, char separator = ','); -nigiri::unixtime_t get_date_time(std::optional const& date = {}, - std::optional const& time = {}); - date::sys_days parse_iso_date(std::string_view); nigiri::routing::query cursor_to_query(std::string_view); diff --git a/src/parse_location.cc b/src/parse_location.cc index 120c5461d..eee4f988f 100644 --- a/src/parse_location.cc +++ b/src/parse_location.cc @@ -42,32 +42,6 @@ std::optional parse_location(std::string_view s, return osr::location{pos, osr::level_t{level}}; } -n::unixtime_t get_date_time(std::optional const& date, - std::optional const& time) { - if (!date.has_value()) { - utl::verify(!time.has_value(), "time without date no supported"); - return std::chrono::time_point_cast( - std::chrono::system_clock::now()); - } else { - utl::verify(time.has_value(), "date without time not supported"); - auto const date_time = *date + " " + *time; - - // 06-28-2024 7:06pm - // 06-28-2024 19:06 - std::stringstream ss; - ss << date_time; - - auto t = n::unixtime_t{}; - if (date_time.contains("AM") || date_time.contains("PM")) { - ss >> date::parse("%m-%d-%Y %I:%M %p", t); - } else { - ss >> date::parse("%m-%d-%Y %H:%M", t); - } - - return t; - } -} - date::sys_days parse_iso_date(std::string_view s) { auto d = date::sys_days{}; (std::stringstream{} << s) >> date::parse("%F", d); diff --git a/test/read_test.cc b/test/read_test.cc index 7333a7d73..f1d75fe7a 100644 --- a/test/read_test.cc +++ b/test/read_test.cc @@ -20,11 +20,6 @@ TEST(motis, parse_location_no_level) { EXPECT_EQ((osr::location{{-23.1, 45.2}, osr::level_t{0.F}}), *parsed); } -TEST(motis, parse_date_time) { - auto const t = get_date_time("06-28-2024", "7:06 PM"); - EXPECT_EQ(sys_days{2024_y / June / 28} + 19h + 6min, t); -} - TEST(motis, parse_cursor_earlier) { auto const q = cursor_to_query("EARLIER|1720036560");