feat(Core/Build): Patched to be buildable on FreeBSD 13.0-RELEASE (#9568)

This commit is contained in:
Kaiser
2021-12-08 18:06:26 -05:00
committed by GitHub
parent 85abfafb2b
commit fa46f13b09
3 changed files with 11 additions and 6 deletions

View File

@@ -20,8 +20,7 @@
#include "G3D/BinaryFormat.h" #include "G3D/BinaryFormat.h"
#include "G3D/FileNotFound.h" #include "G3D/FileNotFound.h"
#include <string> #include <string>
#if defined(__aarch64__) || defined(__FreeBSD__)
#if defined(__aarch64__)
#include <sys/time.h> #include <sys/time.h>
#endif #endif

View File

@@ -26,9 +26,9 @@
// Needed for _findfirst // Needed for _findfirst
# include <io.h> # include <io.h>
# ifdef __MINGW32__ # ifdef __MINGW32__
# define stat64 stat # define stat stat
# else # else
# define stat64 _stat64 # define stat _stat
# endif # endif
#else #else
# include <dirent.h> # include <dirent.h>
@@ -580,8 +580,8 @@ bool FileSystem::_isNewer(const std::string& _src, const std::string& _dst) {
int64 FileSystem::_size(const std::string& _filename) { int64 FileSystem::_size(const std::string& _filename) {
const std::string& filename = FilePath::canonicalize(FilePath::expandEnvironmentVariables(_filename)); const std::string& filename = FilePath::canonicalize(FilePath::expandEnvironmentVariables(_filename));
struct stat64 st; struct stat st;
int result = stat64(filename.c_str(), &st); int result = stat(filename.c_str(), &st);
if (result == -1) { if (result == -1) {
#if _HAVE_ZIP /* G3DFIX: Use ZIP-library only if defined */ #if _HAVE_ZIP /* G3DFIX: Use ZIP-library only if defined */

View File

@@ -89,6 +89,12 @@ time_t LocalTimeToUTCTime(time_t time)
{ {
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
return time + _timezone; return time + _timezone;
#elif defined(__FreeBSD__)
struct tm tm;
gmtime_r(&time, &tm);
tm.tm_isdst = -1;
return mktime(&tm);
#else #else
return time + timezone; return time + timezone;
#endif #endif