From ba6e0b72a7908309ce8c428ddbe59bf1f5f1ac52 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sun, 2 May 2021 21:10:57 +0200 Subject: prodos: Start of read support --- src/lib/util/timeconv.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/lib/util/timeconv.cpp') diff --git a/src/lib/util/timeconv.cpp b/src/lib/util/timeconv.cpp index 20f4e29a03e..084e989b513 100644 --- a/src/lib/util/timeconv.cpp +++ b/src/lib/util/timeconv.cpp @@ -32,6 +32,23 @@ std::chrono::system_clock::duration system_clock_adjustment(calculate_system_clo IMPLEMENTATION ***************************************************************************/ +arbitrary_datetime arbitrary_datetime::now() +{ + time_t sec; + time(&sec); + auto t = *localtime(&sec); + + arbitrary_datetime dt; + dt.year = t.tm_year + 1900; + dt.month = t.tm_mon + 1; + dt.day_of_month = t.tm_mday; + dt.hour = t.tm_hour; + dt.minute = t.tm_min; + dt.second = t.tm_sec; + + return dt; +} + static std::chrono::system_clock::duration calculate_system_clock_adjustment() { constexpr auto days_in_year(365); -- cgit v1.2.3-70-g09d2