|
7 | 7 | import java.io.FileNotFoundException; |
8 | 8 | import java.io.IOException; |
9 | 9 | import java.io.PrintStream; |
10 | | -import java.text.SimpleDateFormat; |
| 10 | +import java.time.format.DateTimeFormatter; |
| 11 | +import java.time.ZoneId; |
| 12 | +import java.time.Instant; |
11 | 13 | import java.util.ArrayList; |
12 | 14 | import java.util.StringTokenizer; |
13 | | -import java.util.TimeZone; |
14 | 15 | import java.util.logging.Level; |
15 | 16 | import java.util.logging.Logger; |
16 | 17 |
|
@@ -40,14 +41,9 @@ public class MagneticFields { |
40 | 41 | /** |
41 | 42 | * A formatter to get the time in down to seconds (no day info). |
42 | 43 | */ |
43 | | - private static SimpleDateFormat formatterlong; |
44 | | - |
45 | | - static { |
46 | | - TimeZone tz = TimeZone.getDefault(); |
47 | | - |
48 | | - formatterlong = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); |
49 | | - formatterlong.setTimeZone(tz); |
50 | | - } |
| 44 | + private static final DateTimeFormatter formatterlong = DateTimeFormatter |
| 45 | + .ofPattern("yyyy/MM/dd HH:mm:ss") |
| 46 | + .withZone(ZoneId.systemDefault()); |
51 | 47 |
|
52 | 48 | // version of mag field package |
53 | 49 | private static String VERSION = "1.20"; |
@@ -1660,7 +1656,7 @@ public String fileBaseNames() { |
1660 | 1656 | * @return a string representation of the current time, down to seconds. |
1661 | 1657 | */ |
1662 | 1658 | public static String dateStringLong(long longtime) { |
1663 | | - return formatterlong.format(longtime); |
| 1659 | + return formatterlong.format(Instant.ofEpochMilli(longtime)); |
1664 | 1660 | } |
1665 | 1661 |
|
1666 | 1662 | /** |
|
0 commit comments