From d057c797335e415e54a5c0ecb69a12e98402db2e Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 23 Jul 2018 07:54:53 +0200 Subject: [PATCH] RSX: use localtime_s instead of localtime --- Utilities/date_time.h | 32 +++++++++++++++++++++++++++++++ rpcs3/Emu/RSX/Overlays/overlays.h | 16 +++------------- rpcs3/Emu/RSX/rsx_methods.cpp | 3 +-- rpcs3/date_time.h | 13 ------------- rpcs3/emucore.vcxproj | 2 +- rpcs3/emucore.vcxproj.filters | 2 +- 6 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 Utilities/date_time.h delete mode 100644 rpcs3/date_time.h diff --git a/Utilities/date_time.h b/Utilities/date_time.h new file mode 100644 index 0000000000..97e9c0a92b --- /dev/null +++ b/Utilities/date_time.h @@ -0,0 +1,32 @@ +#pragma once + +namespace date_time +{ + static inline tm get_time(time_t* _time) + { + tm buf; + time_t t = time(_time); +#ifdef _MSC_VER + localtime_s(&buf, &t); +#else + buf = *localtime(&t); +#endif + return buf; + } + + static inline std::string current_time() + { + char str[80]; + tm now = get_time(0); + strftime(str, sizeof(str), "%c", &now); + return str; + } + + static inline std::string current_time_narrow() + { + char str[80]; + tm now = get_time(0); + strftime(str, sizeof(str), "%Y%m%d%H%M%S", &now); + return str; + } +} diff --git a/rpcs3/Emu/RSX/Overlays/overlays.h b/rpcs3/Emu/RSX/Overlays/overlays.h index 5389b03229..704a135a16 100644 --- a/rpcs3/Emu/RSX/Overlays/overlays.h +++ b/rpcs3/Emu/RSX/Overlays/overlays.h @@ -1,6 +1,7 @@ #pragma once #include "overlay_controls.h" +#include "../../../Utilities/date_time.h" #include "../../../Utilities/Thread.h" #include "../../Io/PadHandler.h" #include "Emu/Memory/vm.h" @@ -14,8 +15,6 @@ #include "Utilities/CPUStats.h" #include "Utilities/Timer.h" -#include - extern u64 get_system_time(); // Definition of user interface implementations @@ -542,15 +541,6 @@ namespace rsx std::unique_ptr