Util: Consolidate and standardize date/time formatting (ticket #2016)

This commit is contained in:
zzz
2019-08-30 18:38:12 +00:00
parent 96d8385f49
commit a6e3621c06
25 changed files with 101 additions and 159 deletions

View File

@@ -5,13 +5,12 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.I2PThread;
import net.i2p.util.Log;
@@ -125,7 +124,6 @@ public class BufferedStatLog implements StatLog {
}
private class StatLogWriter implements Runnable {
private final SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS");
public void run() {
int writeStart = -1;
int writeEnd = -1;
@@ -162,10 +160,7 @@ public class BufferedStatLog implements StatLog {
int cur = start;
while (cur != end) {
//if (shouldLog(_events[cur].getStat())) {
String when = null;
synchronized (_fmt) {
when = _fmt.format(new Date(_events[cur].getTime()));
}
String when = DataHelper.formatTime(_events[cur].getTime());
_out.write(when);
_out.write(" ");
if (_events[cur].getScope() == null)