From ac2007dcbd5529fd2c12646999c3e6be0c2c67f1 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 20 Apr 2017 18:59:03 -0700 Subject: [PATCH] Add System::get_current_date_time() --- toolsrc/include/vcpkg_System.h | 2 ++ toolsrc/src/vcpkg_System.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 41ede55e6..57d159bb5 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -7,6 +7,8 @@ namespace vcpkg::System { + tm get_current_date_time(); + fs::path get_exe_path_of_current_process(); struct ExitCodeAndOutput diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index ec8284e33..8cf9b4874 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -5,6 +5,15 @@ namespace vcpkg::System { + tm get_current_date_time() + { + using std::chrono::system_clock; + std::time_t now_time = system_clock::to_time_t(system_clock::now()); + tm parts; + localtime_s(&parts, &now_time); + return parts; + } + fs::path get_exe_path_of_current_process() { wchar_t buf[_MAX_PATH];