Hotfix/sangshuduo/td 3580 taosdump human timeformat (#5680)
* [TD-3580] <fix>: taosdump support human readable time format. * [TD-3580] <fix>: taosdump support human readable time format. fix no-value-given segfault. Co-authored-by: Shuduo Sang <sdsang@taosdata.com>
This commit is contained in:
parent
a13873e1f9
commit
6d31f34f78
|
@ -483,22 +483,26 @@ static int queryDbImpl(TAOS *taos, char *command) {
|
||||||
static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
if (strcmp(argv[i], "-E") == 0) {
|
if (strcmp(argv[i], "-E") == 0) {
|
||||||
char *tmp = argv[++i];
|
if (argv[i+1]) {
|
||||||
int64_t tmpEpoch;
|
char *tmp = argv[++i];
|
||||||
if (strchr(tmp, ':') && strchr(tmp, '-')) {
|
int64_t tmpEpoch;
|
||||||
if (TSDB_CODE_SUCCESS != taosParseTime(
|
if (strchr(tmp, ':') && strchr(tmp, '-')) {
|
||||||
|
if (TSDB_CODE_SUCCESS != taosParseTime(
|
||||||
tmp, &tmpEpoch, strlen(tmp), TSDB_TIME_PRECISION_MILLI, 0)) {
|
tmp, &tmpEpoch, strlen(tmp), TSDB_TIME_PRECISION_MILLI, 0)) {
|
||||||
fprintf(stderr, "Input end time error!\n");
|
fprintf(stderr, "Input end time error!\n");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tmpEpoch = atoll(tmp);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
tmpEpoch = atoll(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(argv[i], "%"PRId64"", tmpEpoch);
|
sprintf(argv[i], "%"PRId64"", tmpEpoch);
|
||||||
debugPrint("%s() LN%d, tmp is: %s, argv[%d]: %s\n",
|
debugPrint("%s() LN%d, tmp is: %s, argv[%d]: %s\n",
|
||||||
__func__, __LINE__, tmp, i, argv[i]);
|
__func__, __LINE__, tmp, i, argv[i]);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Input end time error!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (strcmp(argv[i], "-g") == 0) {
|
} else if (strcmp(argv[i], "-g") == 0) {
|
||||||
arguments->debug_print = true;
|
arguments->debug_print = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue