diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index e0ee0f6c522423d6da6e8c83e3a7eb98fab43333..f8c634887007a7e6282bda8e59454ca0f2256e2a 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -1408,8 +1408,12 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSml //Default no appendix if (isdigit(pVal[len - 1]) && isdigit(pVal[len - 2])) { - if (info->protocol == SML_LINE_PROTOCOL && info->tsType != SML_TIME_STAMP_NOT_CONFIGURED) { - *tsType = info->tsType; + if (info->protocol == SML_LINE_PROTOCOL) { + if (info->tsType != SML_TIME_STAMP_NOT_CONFIGURED) { + *tsType = info->tsType; + } else { + *tsType = SML_TIME_STAMP_NANO_SECONDS; + } } else if (info->protocol == SML_TELNET_PROTOCOL) { if (len == SML_TIMESTAMP_SECOND_DIGITS) { *tsType = SML_TIME_STAMP_SECONDS; @@ -1421,6 +1425,7 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSml } return true; } + if (pVal[len - 1] == 's') { switch (pVal[len - 2]) { case 'm': @@ -1716,7 +1721,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len, } //No appendix or no timestamp given (len = 0) - if (len >= 1 && isdigit(value[len - 1]) && type != SML_TIME_STAMP_NOW) { + if (len != 0 && type != SML_TIME_STAMP_NOW) { *ts = (int64_t)strtoll(value, NULL, 10); } else { type = SML_TIME_STAMP_NOW; diff --git a/tests/examples/c/apitest.c b/tests/examples/c/apitest.c index 7217de3d55aaeca9bf6ad319ad85248225007e6a..da846de2616abac43d1426e63d9d0d5172c68dee 100644 --- a/tests/examples/c/apitest.c +++ b/tests/examples/c/apitest.c @@ -984,7 +984,7 @@ int32_t verify_schema_less(TAOS* taos) { char* lines2[] = { "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000", - "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000" + "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833641000000" }; code = taos_schemaless_insert(taos, &lines2[0], 1, 0, "ns"); code = taos_schemaless_insert(taos, &lines2[1], 1, 0, "ns"); @@ -1036,7 +1036,6 @@ int main(int argc, char *argv[]) { printf("************ verify schema-less *************\n"); verify_schema_less(taos); - return 0; printf("************ verify query *************\n"); verify_query(taos);