fix the issue #370, support for compilation of vs2019
This commit is contained in:
parent
e21091a6cd
commit
35aa9a95e4
|
@ -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 */
|
/* Try to avoid including windows.h */
|
||||||
#if (defined(__MINGW64__) || defined(__MINGW32__)) && defined(__cplusplus)
|
#if (defined(__MINGW64__) || defined(__MINGW32__)) && defined(__cplusplus)
|
||||||
#define PTW32_INCLUDE_WINDOWS_H
|
#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,
|
* e.g., the local time zone of London in DST is GMT+01:00,
|
||||||
* otherwise is GMT+00: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;
|
int32_t tz = (-timezone * MILLISECOND_PER_SECOND) / MILLISECOND_PER_HOUR;
|
||||||
tz += daylight;
|
tz += daylight;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "os.h"
|
||||||
#include "taosmsg.h"
|
#include "taosmsg.h"
|
||||||
#include "textbuffer.h"
|
#include "textbuffer.h"
|
||||||
#include "tinterpolation.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
|
* 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 revStartime = (startTime / timeRange) * timeRange + timezone * MILLISECOND_PER_SECOND;
|
||||||
int64_t revEndtime = revStartime + timeRange - 1;
|
int64_t revEndtime = revStartime + timeRange - 1;
|
||||||
if (revEndtime < startTime) {
|
if (revEndtime < startTime) {
|
||||||
|
|
Loading…
Reference in New Issue