This commit is contained in:
zyyang 2020-12-22 10:58:10 +08:00
parent dbb866e374
commit a91d886b77
3 changed files with 7 additions and 5 deletions

View File

@ -79,7 +79,7 @@ public class TaosDemoApplication {
// 插入
long tableSize = config.numOfTables;
int threadSize = config.numOfThreadsForInsert;
long startTime = getProperStartTime(config);
long startTime = getProperStartTime(config.startTime, config.keep);
if (tableSize < threadSize)
threadSize = (int) tableSize;
@ -98,10 +98,9 @@ public class TaosDemoApplication {
System.exit(0);
}
private static long getProperStartTime(JdbcTaosdemoConfig config) {
private static long getProperStartTime(long startTime, int keep) {
Instant now = Instant.now();
long earliest = now.minus(Duration.ofDays(config.keep)).toEpochMilli();
long startTime = config.startTime;
long earliest = now.minus(Duration.ofDays(keep)).toEpochMilli();
if (startTime == 0 || startTime < earliest) {
startTime = earliest;
}

View File

@ -63,7 +63,7 @@ public class SubTableService extends AbstractService {
// 插入: 多表insert into xxx values(),()... xxx values(),()...
public int insert(List<SubTableValue> subTableValues) {
return mapper.insertMultiTableMultiValuesUsingSuperTable(subTableValues);
return mapper.insertMultiTableMultiValues(subTableValues);
}
// 插入单表自动建表, insert into xxx using xxx tags(...) values(),()...

View File

@ -17,6 +17,9 @@ public class TimeStampUtilTest {
@Test
public void longToDatetime() {
System.out.println(TimeStampUtil.longToDatetime(1293244920052l));
String datetime = TimeStampUtil.longToDatetime(1510000000000L);
assertEquals("2017-11-07 04:26:40.000", datetime);
long timestamp = TimeStampUtil.datetimeToLong(datetime);