提交 398c3e79 编写于 作者: H Haojun Liao

[td-225] refactor codes.

上级 4a7d25c8
...@@ -560,7 +560,7 @@ static void doInitGlobalConfig() { ...@@ -560,7 +560,7 @@ static void doInitGlobalConfig() {
cfg.ptr = &tsMinIntervalTime; cfg.ptr = &tsMinIntervalTime;
cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.valType = TAOS_CFG_VTYPE_INT32;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 10; cfg.minValue = 1;
cfg.maxValue = 1000000; cfg.maxValue = 1000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS; cfg.unitType = TAOS_CFG_UTYPE_MS;
......
...@@ -82,7 +82,7 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in ...@@ -82,7 +82,7 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
} }
int64_t start = ((startTime - intervalTime) / slidingTime + 1) * slidingTime; int64_t start = ((startTime - intervalTime) / slidingTime + 1) * slidingTime;
if (!(timeUnit == 'a' || timeUnit == 'm' || timeUnit == 's' || timeUnit == 'h')) { if (!(timeUnit == 'u' || timeUnit == 'a' || timeUnit == 'm' || timeUnit == 's' || timeUnit == 'h')) {
/* /*
* here we revised the start time of day according to the local time zone, * here we revised the start time of day according to the local time zone,
* but in case of DST, the start time of one day need to be dynamically decided. * but in case of DST, the start time of one day need to be dynamically decided.
......
...@@ -107,7 +107,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order); ...@@ -107,7 +107,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order);
STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete); STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete);
STSBuf* tsBufCreateFromCompBlocks(const char* pData, int32_t numOfBlocks, int32_t len, int32_t tsOrder); STSBuf* tsBufCreateFromCompBlocks(const char* pData, int32_t numOfBlocks, int32_t len, int32_t tsOrder);
void* tsBufDestory(STSBuf* pTSBuf); void* tsBufDestroy(STSBuf* pTSBuf);
void tsBufAppend(STSBuf* pTSBuf, int32_t vnodeId, int64_t tag, const char* pData, int32_t len); void tsBufAppend(STSBuf* pTSBuf, int32_t vnodeId, int64_t tag, const char* pData, int32_t len);
int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf, int32_t vnodeIdx); int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf, int32_t vnodeIdx);
......
...@@ -317,29 +317,34 @@ int32_t parseLocaltimeWithDst(char* timestr, int64_t* time, int32_t timePrec) { ...@@ -317,29 +317,34 @@ int32_t parseLocaltimeWithDst(char* timestr, int64_t* time, int32_t timePrec) {
static int32_t getTimestampInUsFromStrImpl(int64_t val, char unit, int64_t* result) { static int32_t getTimestampInUsFromStrImpl(int64_t val, char unit, int64_t* result) {
*result = val; *result = val;
int64_t factor = 1000L;
switch (unit) { switch (unit) {
case 's': case 's':
(*result) *= MILLISECOND_PER_SECOND; (*result) *= MILLISECOND_PER_SECOND*factor;
break; break;
case 'm': case 'm':
(*result) *= MILLISECOND_PER_MINUTE; (*result) *= MILLISECOND_PER_MINUTE*factor;
break; break;
case 'h': case 'h':
(*result) *= MILLISECOND_PER_HOUR; (*result) *= MILLISECOND_PER_HOUR*factor;
break; break;
case 'd': case 'd':
(*result) *= MILLISECOND_PER_DAY; (*result) *= MILLISECOND_PER_DAY*factor;
break; break;
case 'w': case 'w':
(*result) *= MILLISECOND_PER_WEEK; (*result) *= MILLISECOND_PER_WEEK*factor;
break; break;
case 'n': case 'n':
(*result) *= MILLISECOND_PER_MONTH; (*result) *= MILLISECOND_PER_MONTH*factor;
break; break;
case 'y': case 'y':
(*result) *= MILLISECOND_PER_YEAR; (*result) *= MILLISECOND_PER_YEAR*factor;
break; break;
case 'a': case 'a':
(*result) *= factor;
break;
case 'u':
break; break;
default: { default: {
; ;
...@@ -348,7 +353,6 @@ static int32_t getTimestampInUsFromStrImpl(int64_t val, char unit, int64_t* resu ...@@ -348,7 +353,6 @@ static int32_t getTimestampInUsFromStrImpl(int64_t val, char unit, int64_t* resu
} }
/* get the value in microsecond */ /* get the value in microsecond */
(*result) *= 1000L;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册