提交 35aa9a95 编写于 作者: S slguan

fix the issue #370, support for compilation of vs2019

上级 e21091a6
......@@ -189,6 +189,19 @@
* -------------------------------------------------------------
*/
/*
_MSC_VER 1910 vs2019
_MSC_VER 1910 vs2017
_MSC_VER 1900 vs2015
_MSC_VER 1800 vs2013
*/
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#define HAVE_STRUCT_TIMESPEC
#endif
#endif
/* Try to avoid including windows.h */
#if (defined(__MINGW64__) || defined(__MINGW32__)) && defined(__cplusplus)
#define PTW32_INCLUDE_WINDOWS_H
......
......@@ -858,6 +858,15 @@ void tsSetTimeZone() {
* e.g., the local time zone of London in DST is GMT+01:00,
* otherwise is GMT+00:00
*/
#ifdef _MSC_VER
#if _MSC_VER >= 1900
// see https://docs.microsoft.com/en-us/cpp/c-runtime-library/daylight-dstbias-timezone-and-tzname?view=vs-2019
int64_t timezone = _timezone;
int32_t daylight = _daylight;
char **tzname = _tzname;
#endif
#endif
int32_t tz = (-timezone * MILLISECOND_PER_SECOND) / MILLISECOND_PER_HOUR;
tz += daylight;
......
......@@ -16,6 +16,7 @@
#include <assert.h>
#include <stdint.h>
#include "os.h"
#include "taosmsg.h"
#include "textbuffer.h"
#include "tinterpolation.h"
......@@ -38,6 +39,15 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t timeRange, char
*
* TODO dynmaically decide the start time of a day
*/
#ifdef _MSC_VER
#if _MSC_VER >= 1900
// see https://docs.microsoft.com/en-us/cpp/c-runtime-library/daylight-dstbias-timezone-and-tzname?view=vs-2019
int64_t timezone = _timezone;
int32_t daylight = _daylight;
char** tzname = _tzname;
#endif
#endif
int64_t revStartime = (startTime / timeRange) * timeRange + timezone * MILLISECOND_PER_SECOND;
int64_t revEndtime = revStartime + timeRange - 1;
if (revEndtime < startTime) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册