diff --git a/recipes/date/all/test_package/CMakeLists.txt b/recipes/date/all/test_package/CMakeLists.txt index 276e986aaf0a2..7a4b3fe1c9b08 100644 --- a/recipes/date/all/test_package/CMakeLists.txt +++ b/recipes/date/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -find_package(date REQUIRED CONFIG) +find_package(date REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE date::date) diff --git a/recipes/date/all/test_package/test_package.cpp b/recipes/date/all/test_package/test_package.cpp index 8dcac9f656989..4ccf632e8e904 100644 --- a/recipes/date/all/test_package/test_package.cpp +++ b/recipes/date/all/test_package/test_package.cpp @@ -1,60 +1,16 @@ #include "date/date.h" #include "date/tz.h" - -#include -#include #include -#include - -class ZoneOffset { -public: - explicit ZoneOffset(std::chrono::minutes offset) - : _offset(offset) {} - - template - auto to_local(date::sys_time tp) const - -> date::local_time::type> { - using namespace date; - using namespace std::chrono; - using LT = local_time::type>; - return LT{(tp + _offset).time_since_epoch()}; - } - - template - auto to_sys(date::local_time tp) const - -> date::sys_time::type> { - using namespace date; - using namespace std::chrono; - using ST = sys_time::type>; - return ST{(tp - _offset).time_since_epoch()}; - } - -private: - std::chrono::minutes _offset; -}; int main() { - using namespace std::chrono; - using namespace date; - - auto date1 = 2015_y/March/22; - std::cout << date1 << '\n'; - auto date2 = March/22/2015; - std::cout << date2 << '\n'; - auto date3 = 22_d/March/2015; - std::cout << date3 << '\n'; - - ZoneOffset p3_45{hours{3} + minutes{45}}; - zoned_time zt{&p3_45, floor(system_clock::now())}; - std::cout << zt.get_sys_time() << " (sys time)\n"; - std::cout << zt.get_local_time() << " (local time)\n"; + const date::year_month_day conan_two(date::year(2023), date::month(2), date::day(22)); + std::cout << "Conan was released on: " << conan_two << std::endl; #ifndef DATE_HEADER_ONLY try { - auto tz = date::current_zone()->name(); - std::cout << "timezone: " << tz << std::endl; - } catch (const std::exception & e) { - std::cout << "exception caught " << e.what() << std::endl; + const date::time_zone* tz = date::current_zone(); + } + catch (const std::exception & e) { } #endif diff --git a/recipes/date/all/test_v1_package/CMakeLists.txt b/recipes/date/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 925ecbe19e448..0000000000000 --- a/recipes/date/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ - ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/date/all/test_v1_package/conanfile.py b/recipes/date/all/test_v1_package/conanfile.py deleted file mode 100644 index 09dc5f4a353ed..0000000000000 --- a/recipes/date/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,18 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.definitions["DATE_HEADER_ONLY"] = self.options["date:header_only"] - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True)