change
This commit is contained in:
parent
dbb866e374
commit
a91d886b77
|
@ -79,7 +79,7 @@ public class TaosDemoApplication {
|
||||||
// 插入
|
// 插入
|
||||||
long tableSize = config.numOfTables;
|
long tableSize = config.numOfTables;
|
||||||
int threadSize = config.numOfThreadsForInsert;
|
int threadSize = config.numOfThreadsForInsert;
|
||||||
long startTime = getProperStartTime(config);
|
long startTime = getProperStartTime(config.startTime, config.keep);
|
||||||
|
|
||||||
if (tableSize < threadSize)
|
if (tableSize < threadSize)
|
||||||
threadSize = (int) tableSize;
|
threadSize = (int) tableSize;
|
||||||
|
@ -98,10 +98,9 @@ public class TaosDemoApplication {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long getProperStartTime(JdbcTaosdemoConfig config) {
|
private static long getProperStartTime(long startTime, int keep) {
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
long earliest = now.minus(Duration.ofDays(config.keep)).toEpochMilli();
|
long earliest = now.minus(Duration.ofDays(keep)).toEpochMilli();
|
||||||
long startTime = config.startTime;
|
|
||||||
if (startTime == 0 || startTime < earliest) {
|
if (startTime == 0 || startTime < earliest) {
|
||||||
startTime = earliest;
|
startTime = earliest;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class SubTableService extends AbstractService {
|
||||||
|
|
||||||
// 插入: 多表,insert into xxx values(),()... xxx values(),()...
|
// 插入: 多表,insert into xxx values(),()... xxx values(),()...
|
||||||
public int insert(List<SubTableValue> subTableValues) {
|
public int insert(List<SubTableValue> subTableValues) {
|
||||||
return mapper.insertMultiTableMultiValuesUsingSuperTable(subTableValues);
|
return mapper.insertMultiTableMultiValues(subTableValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 插入:单表,自动建表, insert into xxx using xxx tags(...) values(),()...
|
// 插入:单表,自动建表, insert into xxx using xxx tags(...) values(),()...
|
||||||
|
|
|
@ -17,6 +17,9 @@ public class TimeStampUtilTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void longToDatetime() {
|
public void longToDatetime() {
|
||||||
|
System.out.println(TimeStampUtil.longToDatetime(1293244920052l));
|
||||||
|
|
||||||
|
|
||||||
String datetime = TimeStampUtil.longToDatetime(1510000000000L);
|
String datetime = TimeStampUtil.longToDatetime(1510000000000L);
|
||||||
assertEquals("2017-11-07 04:26:40.000", datetime);
|
assertEquals("2017-11-07 04:26:40.000", datetime);
|
||||||
long timestamp = TimeStampUtil.datetimeToLong(datetime);
|
long timestamp = TimeStampUtil.datetimeToLong(datetime);
|
||||||
|
|
Loading…
Reference in New Issue