diff --git a/.gitmodules b/.gitmodules index e96848c3..d63fd70b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,6 +22,3 @@ [submodule "extern/Nuked-OPL3"] path = extern/Nuked-OPL3 url = https://github.com/nukeykt/Nuked-OPL3.git -[submodule "extern/date"] - path = extern/date - url = https://github.com/HowardHinnant/date diff --git a/CMakeLists.txt b/CMakeLists.txt index 2989a36f..d3b98fc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,6 @@ option(SYSTEM_LIBSNDFILE "Use a system-installed version of libsndfile instead o option(SYSTEM_RTMIDI "Use a system-installed version of RtMidi instead of the vendored one" OFF) option(SYSTEM_ZLIB "Use a system-installed version of zlib instead of the vendored one" OFF) option(SYSTEM_SDL2 "Use a system-installed version of SDL2 instead of the vendored one" ${SYSTEM_SDL2_DEFAULT}) -option(SYSTEM_DATE "Use a system-installed version of Date instead of the vendored one" OFF) option(WARNINGS_ARE_ERRORS "Whether warnings in furnace's C++ code should be treated as errors" OFF) set(DEPENDENCIES_INCLUDE_DIRS "") @@ -127,25 +126,6 @@ if (USE_RTMIDI) endif() endif() -if (SYSTEM_DATE) - find_package(PkgConfig REQUIRED) - pkg_check_modules(HHDATE REQUIRED date) - list(APPEND DEPENDENCIES_INCLUDE_DIRS ${HHDATE_INCLUDE_DIRS}) - list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${HHDATE_CFLAGS_OTHER}) - list(APPEND DEPENDENCIES_LIBRARIES ${HHDATE_LIBRARIES}) - list(APPEND DEPENDENCIES_LIBRARY_DIRS ${HHDATE_LIBRARY_DIRS}) - list(APPEND DEPENDENCIES_LINK_OPTIONS ${HHDATE_LDFLAGS_OTHER}) - list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${HHDATE_LDFLAGS}) - message(STATUS "Using system-installed Date") -else() - set(BUILD_TZ_LIB ON CACHE BOOL "build/install of TZ library" FORCE) - set(USE_SYSTEM_TZ_DB ON CACHE BOOL "Fix the build already" FORCE) - add_subdirectory(extern/date EXCLUDE_FROM_ALL) - list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/date/include) - list(APPEND DEPENDENCIES_LIBRARIES date date-tz) - message(STATUS "Using vendored Date") -endif() - if (SYSTEM_ZLIB) find_package(PkgConfig REQUIRED) pkg_check_modules(ZLIB REQUIRED zlib) diff --git a/extern/date b/extern/date deleted file mode 160000 index 9ea5654c..00000000 --- a/extern/date +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9ea5654c1206e19245dc21d8a2c433e090c8c3f5 diff --git a/src/gui/log.cpp b/src/gui/log.cpp index b6536cdb..2246df4e 100644 --- a/src/gui/log.cpp +++ b/src/gui/log.cpp @@ -1,7 +1,5 @@ #include "gui.h" #include "../ta-log.h" -#include -#include "date/tz.h" const char* logLevels[5]={ "ERROR", @@ -56,11 +54,9 @@ void FurnaceGUI::drawLog() { const LogEntry& logEntry=logEntries[(pos+i)&(TA_LOG_SIZE-1)]; if (!logEntry.ready) continue; if (logLevel(logEntry.time))); ImGui::TableNextRow(); ImGui::TableNextColumn(); - // this will fail on 32-bit :< - ImGui::TextUnformatted(t.c_str()); + ImGui::Text("%02d:%02d:%02d",logEntry.time.tm_hour,logEntry.time.tm_min,logEntry.time.tm_sec); ImGui::TableNextColumn(); ImGui::TextColored(uiColors[logColors[logEntry.loglevel]],"%s",logLevels[logEntry.loglevel]); ImGui::TableNextColumn(); @@ -75,4 +71,4 @@ void FurnaceGUI::drawLog() { } } ImGui::End(); -} \ No newline at end of file +} diff --git a/src/log.cpp b/src/log.cpp index a3a6000c..d0ea0603 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -90,11 +90,16 @@ int logE(const char* format, ...) { } int writeLog(int level, const char* msg, fmt::printf_args& args) { + time_t thisMakesNoSense=time(NULL); int pos=logPosition; logPosition=(logPosition+1)&TA_LOG_MASK; logEntries[pos].text=fmt::vsprintf(msg,args); - logEntries[pos].time=std::chrono::system_clock::now(); + // why do I have to pass a pointer + // can't I just pass the time_t directly?! + if (localtime_r(&thisMakesNoSense,&logEntries[pos].time)==NULL) { + memset(&logEntries[pos].time,0,sizeof(struct tm)); + } logEntries[pos].loglevel=level; logEntries[pos].ready=true; @@ -119,4 +124,4 @@ void initLog() { for (int i=0; i #include #include +#include #include #include #include @@ -41,7 +41,7 @@ extern std::atomic logPosition; struct LogEntry { int loglevel; - std::chrono::system_clock::time_point time; + struct tm time; std::string text; bool ready; LogEntry():