From faf6243d1a8cbc898cb254ec62f53256945820be Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <seth@kipro-pcb.com>
Date: Fri, 21 Mar 2025 14:42:52 -0700
Subject: [PATCH] Fix build on Windows

---
 common/git/git_pull_handler.cpp | 6 +++++-
 common/git/kicad_git_common.cpp | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/common/git/git_pull_handler.cpp b/common/git/git_pull_handler.cpp
index 95507ec991..bedc30b0dd 100644
--- a/common/git/git_pull_handler.cpp
+++ b/common/git/git_pull_handler.cpp
@@ -208,7 +208,11 @@ std::string GIT_PULL_HANDLER::getFormattedCommitDate( const git_time& aTime )
     char   dateBuffer[64];
     time_t time = static_cast<time_t>( aTime.time );
     struct tm timeInfo;
-    gmtime_r( &time, &timeInfo );
+    #ifdef _WIN32
+        localtime_s( &timeInfo, &time );
+    #else
+        gmtime_r( &time, &timeInfo );
+    #endif
     strftime( dateBuffer, sizeof( dateBuffer ), "%Y-%b-%d %H:%M:%S", &timeInfo );
     return dateBuffer;
 }
diff --git a/common/git/kicad_git_common.cpp b/common/git/kicad_git_common.cpp
index 2e6c0adbfb..9a2ea404fc 100644
--- a/common/git/kicad_git_common.cpp
+++ b/common/git/kicad_git_common.cpp
@@ -29,6 +29,7 @@
 #include <kiplatform/secrets.h>
 #include <trace_helpers.h>
 
+#include <git2.h>
 #include <wx/filename.h>
 #include <wx/log.h>
 #include <wx/textfile.h>