compile in windows

This commit is contained in:
Shengliang Guan 2020-09-17 12:14:34 +08:00
parent 0eaffe9032
commit 2d6f6afc17
1 changed files with 6 additions and 6 deletions

View File

@ -419,7 +419,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) {
tm.tm_year = mon / 12; tm.tm_year = mon / 12;
tm.tm_mon = mon % 12; tm.tm_mon = mon % 12;
return mktime(&tm) * TSDB_TICK_PER_SECOND(precision); return (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision));
} }
int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision) { int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision) {
@ -432,8 +432,8 @@ int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char
return (int32_t)((ekey - skey) / interval); return (int32_t)((ekey - skey) / interval);
} }
skey /= TSDB_TICK_PER_SECOND(precision); skey /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
ekey /= TSDB_TICK_PER_SECOND(precision); ekey /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
struct tm tm; struct tm tm;
time_t t = (time_t)skey; time_t t = (time_t)skey;
@ -459,7 +459,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
int64_t start = t; int64_t start = t;
if (pInterval->slidingUnit == 'n' || pInterval->slidingUnit == 'y') { if (pInterval->slidingUnit == 'n' || pInterval->slidingUnit == 'y') {
start /= TSDB_TICK_PER_SECOND(precision); start /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
struct tm tm; struct tm tm;
time_t tt = (time_t)start; time_t tt = (time_t)start;
localtime_r(&tt, &tm); localtime_r(&tt, &tm);
@ -478,7 +478,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
tm.tm_mon = mon % 12; tm.tm_mon = mon % 12;
} }
start = mktime(&tm) * TSDB_TICK_PER_SECOND(precision); start = (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision));
} else { } else {
int64_t delta = t - pInterval->interval; int64_t delta = t - pInterval->interval;
int32_t factor = delta > 0 ? 1 : -1; int32_t factor = delta > 0 ? 1 : -1;
@ -498,7 +498,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
char** tzname = _tzname; char** tzname = _tzname;
#endif #endif
start += timezone * TSDB_TICK_PER_SECOND(precision); start += (int64_t)(timezone * TSDB_TICK_PER_SECOND(precision));
} }
int64_t end = start + pInterval->interval - 1; int64_t end = start + pInterval->interval - 1;