From c82a927556d69a86b666a01f25bae38d4e6ac76a Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 24 Jun 2022 17:55:08 +0200 Subject: [PATCH] GS: Cleanup variable scope. Codacy. --- pcsx2/GS/Renderers/Common/GSRenderer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pcsx2/GS/Renderers/Common/GSRenderer.cpp b/pcsx2/GS/Renderers/Common/GSRenderer.cpp index 4018d9c759..b5875bd7b5 100644 --- a/pcsx2/GS/Renderers/Common/GSRenderer.cpp +++ b/pcsx2/GS/Renderers/Common/GSRenderer.cpp @@ -724,16 +724,17 @@ void GSRenderer::QueueSnapshot(const std::string& path, u32 gsdump_frames) else { time_t cur_time = time(nullptr); - static time_t prev_snap; - // The variable 'n' is used for labelling the screenshots when multiple screenshots are taken in - // a single second, we'll start using this variable for naming when a second screenshot request is detected - // at the same time as the first one. Hence, we're initially setting this counter to 2 to imply that - // the captured image is the 2nd image captured at this specific time. - static int n = 2; char local_time[16]; if (strftime(local_time, sizeof(local_time), "%Y%m%d%H%M%S", localtime(&cur_time))) { + static time_t prev_snap; + // The variable 'n' is used for labelling the screenshots when multiple screenshots are taken in + // a single second, we'll start using this variable for naming when a second screenshot request is detected + // at the same time as the first one. Hence, we're initially setting this counter to 2 to imply that + // the captured image is the 2nd image captured at this specific time. + static int n = 2; + if (cur_time == prev_snap) m_snapshot = fmt::format("gs_{0}_({1})", local_time, n++); else