Skip to content

Commit

Permalink
[improvement] Use System.currentTimeMillis() to get the current milli…
Browse files Browse the repository at this point in the history
…second (#8828)
  • Loading branch information
xleoken authored Apr 14, 2022
1 parent 4cfb372 commit a1982c4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static String getFullName(String schemaName, String tableName) {

public static void printRow(CanalEntry.RowChange rowChange, CanalEntry.Header header) {
long executeTime = header.getExecuteTime();
long delayTime = new Date().getTime() - executeTime;
long delayTime = System.currentTimeMillis() - executeTime;
Date date = new Date(executeTime);
CanalEntry.EventType eventType = rowChange.getEventType();
logger.info(row_format, header.getLogfileName(),
Expand Down Expand Up @@ -187,7 +187,7 @@ public static void printXAInfo(List<CanalEntry.Pair> pairs) {

public static void transactionBegin(CanalEntry.Entry entry) {
long executeTime = entry.getHeader().getExecuteTime();
long delayTime = new Date().getTime() - executeTime;
long delayTime = System.currentTimeMillis() - executeTime;
Date date = new Date(executeTime);
CanalEntry.TransactionBegin begin = null;
try {
Expand All @@ -206,7 +206,7 @@ public static void transactionBegin(CanalEntry.Entry entry) {

public static void transactionEnd(CanalEntry.Entry entry) {
long executeTime = entry.getHeader().getExecuteTime();
long delayTime = new Date().getTime() - executeTime;
long delayTime = System.currentTimeMillis() - executeTime;
Date date = new Date(executeTime);
CanalEntry.TransactionEnd end = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public TExecPlanFragmentParams plan(TUniqueId loadId) throws UserException {
params.setQueryOptions(queryOptions);
TQueryGlobals queryGlobals = new TQueryGlobals();
queryGlobals.setNowString(DATE_FORMAT.format(new Date()));
queryGlobals.setTimestampMs(new Date().getTime());
queryGlobals.setTimestampMs(System.currentTimeMillis());
queryGlobals.setTimeZone(taskInfo.getTimezone());
queryGlobals.setLoadZeroTolerance(taskInfo.getMaxFilterRatio() <= 0.0);

Expand Down
4 changes: 2 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public Coordinator(ConnectContext context, Analyzer analyzer, Planner planner) {
setFromUserProperty(analyzer);

this.queryGlobals.setNowString(DATE_FORMAT.format(new Date()));
this.queryGlobals.setTimestampMs(new Date().getTime());
this.queryGlobals.setTimestampMs(System.currentTimeMillis());
this.queryGlobals.setLoadZeroTolerance(false);
if (context.getSessionVariable().getTimeZone().equals("CST")) {
this.queryGlobals.setTimeZone(TimeUtils.DEFAULT_TIME_ZONE);
Expand Down Expand Up @@ -263,7 +263,7 @@ public Coordinator(Long jobId, TUniqueId queryId, DescriptorTable descTable,
this.scanNodes = scanNodes;
this.queryOptions = new TQueryOptions();
this.queryGlobals.setNowString(DATE_FORMAT.format(new Date()));
this.queryGlobals.setTimestampMs(new Date().getTime());
this.queryGlobals.setTimestampMs(System.currentTimeMillis());
this.queryGlobals.setTimeZone(timezone);
this.queryGlobals.setLoadZeroTolerance(loadZeroTolerance);
this.tResourceInfo = new TResourceInfo("", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private Map<String, Map<String, Expr>> calcConstExpr(Map<String, Map<String, TEx

TQueryGlobals queryGlobals = new TQueryGlobals();
queryGlobals.setNowString(DATE_FORMAT.format(new Date()));
queryGlobals.setTimestampMs(new Date().getTime());
queryGlobals.setTimestampMs(System.currentTimeMillis());
queryGlobals.setTimeZone(TimeUtils.DEFAULT_TIME_ZONE);
if (context.getSessionVariable().getTimeZone().equals("CST")) {
queryGlobals.setTimeZone(TimeUtils.DEFAULT_TIME_ZONE);
Expand Down

0 comments on commit a1982c4

Please sign in to comment.