mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 14:33:01 +00:00
Sorry but I think I'd like to go now.
This commit is contained in:
parent
92b8703574
commit
9e0e725802
6 changed files with 11 additions and 34 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
1
extern/date
vendored
1
extern/date
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit 9ea5654c1206e19245dc21d8a2c433e090c8c3f5
|
|
@ -1,7 +1,5 @@
|
|||
#include "gui.h"
|
||||
#include "../ta-log.h"
|
||||
#include <chrono>
|
||||
#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.loglevel) continue;
|
||||
String t=date::format("%T",date::make_zoned(date::current_zone(),date::floor<std::chrono::seconds>(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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TA_LOG_SIZE; i++) {
|
||||
logEntries[i].text.reserve(128);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
#ifndef _TA_LOG_H
|
||||
#define _TA_LOG_H
|
||||
#include <chrono>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <fmt/printf.h>
|
||||
|
@ -41,7 +41,7 @@ extern std::atomic<unsigned short> logPosition;
|
|||
|
||||
struct LogEntry {
|
||||
int loglevel;
|
||||
std::chrono::system_clock::time_point time;
|
||||
struct tm time;
|
||||
std::string text;
|
||||
bool ready;
|
||||
LogEntry():
|
||||
|
|
Loading…
Reference in a new issue