Skip to content

Commit 9a20bec

Browse files
committed
Ensure SimpleDateFormat is UTC
1 parent 38756d3 commit 9a20bec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/PathUtilities.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.util.Date;
4040
import java.util.Iterator;
4141
import java.util.ServiceLoader;
42+
import java.util.TimeZone;
4243

4344
/**
4445
* Miscellaneous methods for modifying and generating file system paths.
@@ -94,7 +95,13 @@ public static String getPath(String first, String... more) {
9495
* {@code sun.text.resources.cldr.FormatData} as part of {@link SimpleDateFormat} construction)
9596
* and allows us to avoid class-lookup support in the image.
9697
*/
97-
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSS");
98+
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = getSimpleDateFormat();
99+
100+
private static SimpleDateFormat getSimpleDateFormat() {
101+
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSS");
102+
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
103+
return simpleDateFormat;
104+
}
98105

99106
public static DateFormatSymbols getSharedDateFormatSymbols() {
100107
// SimpleDateFormat is not thread-safe

0 commit comments

Comments
 (0)