From f6d133d793ff455b38c749e8f53e6b389cc7f05c Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Mon, 7 Feb 2022 01:32:39 +0100 Subject: [PATCH] gc_dumper: change info TXT layout. --- Makefile | 4 +++- code_templates/gc_dumper.c | 16 ++++++---------- source/core/nxdt_utils.c | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 05efb1d..9216949 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,8 @@ ifneq ($(origin BUILD_TYPE),undefined) APP_TITLE := ${BUILD_TYPE} endif +BUILD_TIMESTAMP := $(strip $(shell date --utc '+%Y-%m-%d %T UTC')) + TARGET := ${APP_TITLE} BUILD := build SOURCES := source source/core source/fatfs @@ -81,7 +83,7 @@ CFLAGS := -g -gdwarf-4 -Wall -Werror -O2 -ffunction-sections $(ARCH) $(DEFINES) CFLAGS += -DVERSION_MAJOR=${VERSION_MAJOR} -DVERSION_MINOR=${VERSION_MINOR} -DVERSION_MICRO=${VERSION_MICRO} CFLAGS += -DAPP_TITLE=\"${APP_TITLE}\" -DAPP_AUTHOR=\"${APP_AUTHOR}\" -DAPP_VERSION=\"${APP_VERSION}\" CFLAGS += -DGIT_BRANCH=\"${GIT_BRANCH}\" -DGIT_COMMIT=\"${GIT_COMMIT}\" -DGIT_REV=\"${GIT_REV}\" -CFLAGS += -DBOREALIS_RESOURCES="\"${BOREALIS_RESOURCES}\"" -D_GNU_SOURCE +CFLAGS += -DBUILD_TIMESTAMP="\"${BUILD_TIMESTAMP}\"" -DBOREALIS_RESOURCES="\"${BOREALIS_RESOURCES}\"" -D_GNU_SOURCE CXXFLAGS := $(CFLAGS) -std=c++20 -Wno-volatile -Wno-unused-parameter diff --git a/code_templates/gc_dumper.c b/code_templates/gc_dumper.c index 7d263b9..edd98b8 100644 --- a/code_templates/gc_dumper.c +++ b/code_templates/gc_dumper.c @@ -470,25 +470,21 @@ static void generateDumpTxt(void) *txt_info = '\0'; struct tm ts = {0}; - struct timespec now = {0}; - - /* Get current time with nanosecond precision. */ - clock_gettime(CLOCK_REALTIME, &now); + time_t now = time(NULL); /* Get UTC time. */ - gmtime_r(&(now.tv_sec), &ts); + gmtime_r(&now, &ts); ts.tm_year += 1900; ts.tm_mon++; /* Generate dump text. */ - snprintf(txt_info, MAX_ELEMENTS(txt_info), "dump info:\r\n" \ - "tool: nxdumptool\r\n" \ + snprintf(txt_info, MAX_ELEMENTS(txt_info), "tool: nxdumptool\r\n" \ "version: " APP_VERSION "\r\n" \ "branch: " GIT_BRANCH "\r\n" \ "commit: " GIT_COMMIT "\r\n" \ - "build date: " __DATE__ " - " __TIME__ "\r\n" \ - "dump date: %d-%02d-%02d %02d:%02d:%02d.%03lu UTC+0\r\n", - ts.tm_year, ts.tm_mon, ts.tm_mday, ts.tm_hour, ts.tm_min, ts.tm_sec, now.tv_nsec); + "build date: " BUILD_TIMESTAMP "\r\n" \ + "dump date: %d-%02d-%02d %02d:%02d:%02d UTC\r\n", \ + ts.tm_year, ts.tm_mon, ts.tm_mday, ts.tm_hour, ts.tm_min, ts.tm_sec); } static bool saveFileData(const char *path, void *data, size_t data_size) diff --git a/source/core/nxdt_utils.c b/source/core/nxdt_utils.c index a94b257..22038e7 100644 --- a/source/core/nxdt_utils.c +++ b/source/core/nxdt_utils.c @@ -136,7 +136,7 @@ bool utilsInitializeResources(const int program_argc, const char **program_argv) /* Create logfile. */ logWriteStringToLogFile("________________________________________________________________\r\n"); - LOG_MSG(APP_TITLE " v" APP_VERSION " starting (" GIT_REV "). Built on " __DATE__ " - " __TIME__ "."); + LOG_MSG(APP_TITLE " v" APP_VERSION " starting (" GIT_REV "). Built on " BUILD_TIMESTAMP "."); /* Log Horizon OS version. */ u32 hos_version = hosversionGet();