Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
201f6c46
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看板
未验证
提交
201f6c46
编写于
6月 29, 2021
作者:
J
Jun Li
提交者:
GitHub
6月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some printf typing issue (#6659)
上级
941e69da
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
14 deletion
+17
-14
src/client/tests/cliTest.cpp
src/client/tests/cliTest.cpp
+2
-1
src/client/tests/timeParseTest.cpp
src/client/tests/timeParseTest.cpp
+15
-13
未找到文件。
src/client/tests/cliTest.cpp
浏览文件 @
201f6c46
#include <gtest/gtest.h>
#include <iostream>
#include <inttypes.h>
#include "taos.h"
#include "tglobal.h"
...
...
@@ -132,7 +133,7 @@ void validateResultFields() {
taos_free_result
(
res
);
char
sql
[
512
]
=
{
0
};
sprintf
(
sql
,
"insert into t1 values(%
ld
, 99, 'abc', 'test')"
,
start_ts
);
sprintf
(
sql
,
"insert into t1 values(%
"
PRId64
"
, 99, 'abc', 'test')"
,
start_ts
);
res
=
taos_query
(
conn
,
sql
);
ASSERT_EQ
(
taos_errno
(
res
),
0
);
...
...
src/client/tests/timeParseTest.cpp
浏览文件 @
201f6c46
#include "os.h"
#include <gtest/gtest.h>
#include <cassert>
#include <iostream>
#include <inttypes.h>
#include "os.h"
#include "taos.h"
#include "ttoken.h"
#include "tutil.h"
...
...
@@ -15,10 +17,10 @@ int main(int argc, char** argv) {
extern
void
deltaToUtcInitOnce
();
/* test parse time function */
TEST
(
testCase
,
parse_time
)
{
taos_options
(
TSDB_OPTION_TIMEZONE
,
"GMT-8"
);
deltaToUtcInitOnce
();
char
t1
[]
=
"2018-1-1 1:1:1.952798"
;
char
t13
[]
=
"1970-1-1 0:0:0"
;
...
...
@@ -77,15 +79,15 @@ TEST(testCase, parse_time) {
taosParseTime
(
t12
,
&
time1
,
strlen
(
t12
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
time1
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"UTC"
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"UTC"
);
deltaToUtcInitOnce
();
taosParseTime
(
t13
,
&
time
,
strlen
(
t13
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
0
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"Asia/Shanghai"
);
deltaToUtcInitOnce
();
char
t14
[]
=
"1970-1-1T0:0:0Z"
;
taosParseTime
(
t14
,
&
time
,
strlen
(
t14
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
0
);
...
...
@@ -135,7 +137,7 @@ TEST(testCase, parse_time) {
//======================== add some case ============================//
char
b1
[]
=
"9999-12-31 23:59:59.999"
;
taosParseTime
(
b1
,
&
time
,
strlen
(
b1
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
253402271999999
);
...
...
@@ -145,27 +147,27 @@ TEST(testCase, parse_time) {
taosParseTime
(
b2
,
&
time
,
strlen
(
b2
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
1577811661321
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"America/New_York"
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"America/New_York"
);
deltaToUtcInitOnce
();
taosParseTime
(
t13
,
&
time
,
strlen
(
t13
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
18000
*
MILLISECOND_PER_SECOND
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"Asia/Tokyo"
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"Asia/Tokyo"
);
deltaToUtcInitOnce
();
taosParseTime
(
t13
,
&
time
,
strlen
(
t13
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
-
32400
*
MILLISECOND_PER_SECOND
);
taos_options
(
TSDB_OPTION_TIMEZONE
,
"Asia/Shanghai"
);
deltaToUtcInitOnce
();
taosParseTime
(
t13
,
&
time
,
strlen
(
t13
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
-
28800
*
MILLISECOND_PER_SECOND
);
char
t
[]
=
"2021-01-08T02:11:40.000+00:00"
;
taosParseTime
(
t
,
&
time
,
strlen
(
t
),
TSDB_TIME_PRECISION_MILLI
,
0
);
printf
(
"%
ld
\n
"
,
time
);
printf
(
"%
"
PRId64
"
\n
"
,
time
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录