Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
77002fa5
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
77002fa5
编写于
6月 15, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2275 from taosdata/hotfix/fixbug-TD-327
fixbug TD-327
上级
2eb8cc45
b99b469d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
41 addition
and
11 deletion
+41
-11
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-2
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-0
src/common/src/ttimezone.c
src/common/src/ttimezone.c
+1
-0
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+0
-1
src/util/inc/ttime.h
src/util/inc/ttime.h
+1
-1
src/util/src/ttime.c
src/util/src/ttime.c
+34
-6
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
77002fa5
...
...
@@ -97,7 +97,7 @@ int tsParseTime(SSQLToken *pToken, int64_t *time, char **next, char *error, int1
useconds
=
str2int64
(
pToken
->
z
);
}
else
{
// strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
tscInvalidSQLErrMsg
(
error
,
"invalid timestamp format"
,
pToken
->
z
);
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
77002fa5
...
...
@@ -138,7 +138,7 @@ static int setColumnFilterInfoForTimestamp(SQueryInfo* pQueryInfo, tVariant* pVa
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
if
(
seg
!=
NULL
)
{
if
(
taosParseTime
(
pVar
->
pz
,
&
time
,
pVar
->
nLen
,
tinfo
.
precision
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
taosParseTime
(
pVar
->
pz
,
&
time
,
pVar
->
nLen
,
tinfo
.
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg
);
}
}
else
{
...
...
@@ -3950,7 +3950,7 @@ int32_t getTimeRange(STimeWindow* win, tSQLExpr* pRight, int32_t optr, int16_t t
char
*
seg
=
strnchr
(
pRight
->
val
.
pz
,
'-'
,
pRight
->
val
.
nLen
,
false
);
if
(
seg
!=
NULL
)
{
if
(
taosParseTime
(
pRight
->
val
.
pz
,
&
val
,
pRight
->
val
.
nLen
,
TSDB_TIME_PRECISION_MICRO
)
==
TSDB_CODE_SUCCESS
)
{
if
(
taosParseTime
(
pRight
->
val
.
pz
,
&
val
,
pRight
->
val
.
nLen
,
TSDB_TIME_PRECISION_MICRO
,
tsDaylight
)
==
TSDB_CODE_SUCCESS
)
{
parsed
=
true
;
}
else
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
src/common/inc/tglobal.h
浏览文件 @
77002fa5
...
...
@@ -170,6 +170,7 @@ extern char gitinfo[];
extern
char
gitinfoOfInternal
[];
extern
char
buildinfo
[];
extern
int8_t
tsDaylight
;
extern
char
tsTimezone
[
64
];
extern
char
tsLocale
[
64
];
extern
char
tsCharset
[
64
];
// default encode string
...
...
src/common/src/tglobal.c
浏览文件 @
77002fa5
...
...
@@ -198,6 +198,7 @@ char tsMonitorDbName[TSDB_DB_NAME_LEN] = "log";
char
tsInternalPass
[]
=
"secretkey"
;
int32_t
tsMonitorInterval
=
30
;
// seconds
int8_t
tsDaylight
=
0
;
char
tsTimezone
[
64
]
=
{
0
};
char
tsLocale
[
TSDB_LOCALE_LEN
]
=
{
0
};
char
tsCharset
[
TSDB_LOCALE_LEN
]
=
{
0
};
// default encode string
...
...
src/common/src/ttimezone.c
浏览文件 @
77002fa5
...
...
@@ -58,6 +58,7 @@ void tsSetTimeZone() {
* (BST, +0100)
*/
sprintf
(
tsTimezone
,
"(%s, %s%02d00)"
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
tsDaylight
=
daylight
;
uPrint
(
"timezone format changed to %s"
,
tsTimezone
);
}
src/kit/shell/src/shellEngine.c
浏览文件 @
77002fa5
...
...
@@ -469,7 +469,6 @@ static int dumpResultToFile(const char* fname, TAOS_RES* result) {
}
while
(
row
!=
NULL
);
fclose
(
fp
);
taos_free_result
(
result
);
return
numOfRows
;
}
...
...
src/util/inc/ttime.h
浏览文件 @
77002fa5
...
...
@@ -56,7 +56,7 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) {
int32_t
getTimestampInUsFromStr
(
char
*
token
,
int32_t
tokenlen
,
int64_t
*
ts
);
int32_t
taosParseTime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
);
int32_t
taosParseTime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
dayligth
);
void
deltaToUtcInitOnce
();
#ifdef __cplusplus
...
...
src/util/src/ttime.c
浏览文件 @
77002fa5
...
...
@@ -24,7 +24,6 @@
#include "taosdef.h"
#include "ttime.h"
#include "tutil.h"
/*
* mktime64 - Converts date to seconds.
* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
...
...
@@ -119,15 +118,21 @@ static int month[12] = {
static
int64_t
parseFraction
(
char
*
str
,
char
**
end
,
int32_t
timePrec
);
static
int32_t
parseTimeWithTz
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltimeWithDst
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
);
static
int32_t
(
*
parseLocaltimeFp
[])
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
=
{
parseLocaltime
,
parseLocaltimeWithDst
};
int32_t
taosGetTimestampSec
()
{
return
(
int32_t
)
time
(
NULL
);
}
int32_t
taosParseTime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
)
{
int32_t
taosParseTime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
daylight
)
{
/* parse datatime string in with tz */
if
(
strnchr
(
timestr
,
'T'
,
len
,
false
)
!=
NULL
)
{
return
parseTimeWithTz
(
timestr
,
time
,
timePrec
);
}
else
{
return
parseLocaltime
(
timestr
,
time
,
timePrec
);
return
(
*
parseLocaltimeFp
[
daylight
])
(
timestr
,
time
,
timePrec
);
}
}
...
...
@@ -304,9 +309,6 @@ int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec) {
return
-
1
;
}
/* mktime will be affected by TZ, set by using taos_options */
//int64_t seconds = mktime(&tm);
//int64_t seconds = (int64_t)user_mktime(&tm);
int64_t
seconds
=
user_mktime64
(
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
);
int64_t
fraction
=
0
;
...
...
@@ -324,6 +326,32 @@ int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec) {
return
0
;
}
int32_t
parseLocaltimeWithDst
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
{
*
time
=
0
;
struct
tm
tm
=
{
0
};
tm
.
tm_isdst
=
-
1
;
char
*
str
=
strptime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
if
(
str
==
NULL
)
{
return
-
1
;
}
/* mktime will be affected by TZ, set by using taos_options */
int64_t
seconds
=
mktime
(
&
tm
);
int64_t
fraction
=
0
;
if
(
*
str
==
'.'
)
{
/* parse the second fraction part */
if
((
fraction
=
parseFraction
(
str
+
1
,
&
str
,
timePrec
))
<
0
)
{
return
-
1
;
}
}
int64_t
factor
=
(
timePrec
==
TSDB_TIME_PRECISION_MILLI
)
?
1000
:
1000000
;
*
time
=
factor
*
seconds
+
fraction
;
return
0
;
}
static
int32_t
getTimestampInUsFromStrImpl
(
int64_t
val
,
char
unit
,
int64_t
*
result
)
{
*
result
=
val
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录