diff --git a/deps/pthread/pthread.h b/deps/pthread/pthread.h index fd27f16b767c587258ed5aab3aaced864400a5f2..e08bf22abcdfc003505e1a3055c84b0d8fd5cd58 100644 --- a/deps/pthread/pthread.h +++ b/deps/pthread/pthread.h @@ -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 diff --git a/src/util/src/tglobalcfg.c b/src/util/src/tglobalcfg.c index 2a3089a539903ca06582f185bab62f1155a41142..e16da7b40749565b12e2f5769c039ee8f6c48ffd 100644 --- a/src/util/src/tglobalcfg.c +++ b/src/util/src/tglobalcfg.c @@ -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; diff --git a/src/util/src/tinterpolation.c b/src/util/src/tinterpolation.c index 12f3064d7a22204d4a4765b0eda87e2c391d99ff..55022cc7c508dbc76ae69df5f017e2392acf4b36 100644 --- a/src/util/src/tinterpolation.c +++ b/src/util/src/tinterpolation.c @@ -16,6 +16,7 @@ #include #include +#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) {