mirror of
https://onedev.site.tesses.net/tesses-framework
synced 2026-02-08 15:55:46 +00:00
fix for freebsd
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
#include "TessesFramework/Date/Date.hpp"
|
#include "TessesFramework/Date/Date.hpp"
|
||||||
#include "TessesFramework/Http/HttpUtils.hpp"
|
#include "TessesFramework/Http/HttpUtils.hpp"
|
||||||
#include "../HowardHinnant_date/date.h"
|
#include "../HowardHinnant_date/date.h"
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -10,16 +13,28 @@ namespace Tesses::Framework::Date
|
|||||||
{
|
{
|
||||||
int GetTimeZone()
|
int GetTimeZone()
|
||||||
{
|
{
|
||||||
#if defined(__SWITCH__) || defined(_WIN32) || defined(GEKKO) || defined(__PS2__) || defined(__FreeBSD__)
|
|
||||||
|
|
||||||
|
#if defined(__SWITCH__) || defined(_WIN32) || defined(GEKKO) || defined(__PS2__)
|
||||||
return (int)(-_timezone);
|
return (int)(-_timezone);
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
struct timeval tv;
|
||||||
|
struct timezone tz;
|
||||||
|
gettimeofday(&tv,&tz);
|
||||||
|
return -(tz.tz_minuteswest/60)
|
||||||
#else
|
#else
|
||||||
return (int)(-timezone);
|
return (int)(-timezone);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
bool TimeZoneSupportDST()
|
bool TimeZoneSupportDST()
|
||||||
{
|
{
|
||||||
#if defined(__SWITCH__) || defined(_WIN32) || defined(GEKKO) || defined(__PS2__) || defined(__FreeBSD__)
|
#if defined(__SWITCH__) || defined(_WIN32) || defined(GEKKO) || defined(__PS2__)
|
||||||
return _daylight == 1;
|
return _daylight == 1;
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
struct timeval tv;
|
||||||
|
struct timezone tz;
|
||||||
|
gettimeofday(&tv,&tz);
|
||||||
|
return tz.tz_dsttime!=0;
|
||||||
#else
|
#else
|
||||||
return daylight == 1;
|
return daylight == 1;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user