|
17 | 17 |
|
18 | 18 | package org.tikv.common.log; |
19 | 19 |
|
20 | | -import static org.tikv.common.log.SlowLogImpl.DATE_FORMAT; |
| 20 | +import static org.tikv.common.log.SlowLogImpl.getSimpleDateFormat; |
21 | 21 |
|
22 | 22 | import com.google.gson.JsonElement; |
23 | 23 | import com.google.gson.JsonObject; |
| 24 | +import java.text.SimpleDateFormat; |
24 | 25 |
|
25 | 26 | public class SlowLogSpanImpl implements SlowLogSpan { |
26 | 27 | private final String name; |
@@ -60,27 +61,28 @@ public void end() { |
60 | 61 |
|
61 | 62 | @Override |
62 | 63 | public JsonElement toJsonElement() { |
| 64 | + SimpleDateFormat simpleDateFormat = getSimpleDateFormat(); |
63 | 65 | JsonObject jsonObject = new JsonObject(); |
64 | 66 | jsonObject.addProperty("name", name); |
65 | | - jsonObject.addProperty("start", getStartString()); |
66 | | - jsonObject.addProperty("end", getEndString()); |
| 67 | + jsonObject.addProperty("start", getStartString(simpleDateFormat)); |
| 68 | + jsonObject.addProperty("end", getEndString(simpleDateFormat)); |
67 | 69 | jsonObject.addProperty("duration", getDurationString()); |
68 | 70 |
|
69 | 71 | return jsonObject; |
70 | 72 | } |
71 | 73 |
|
72 | | - private String getStartString() { |
| 74 | + private String getStartString(SimpleDateFormat simpleDateFormat) { |
73 | 75 | if (startMS == 0) { |
74 | 76 | return "N/A"; |
75 | 77 | } |
76 | | - return DATE_FORMAT.format(startMS); |
| 78 | + return simpleDateFormat.format(startMS); |
77 | 79 | } |
78 | 80 |
|
79 | | - private String getEndString() { |
| 81 | + private String getEndString(SimpleDateFormat simpleDateFormat) { |
80 | 82 | if (endMS == 0) { |
81 | 83 | return "N/A"; |
82 | 84 | } |
83 | | - return DATE_FORMAT.format(endMS); |
| 85 | + return simpleDateFormat.format(endMS); |
84 | 86 | } |
85 | 87 |
|
86 | 88 | private String getDurationString() { |
|
0 commit comments