Skip to content

Commit c58929a

Browse files
CalvinKirsdataroaring
authored andcommitted
[Fix](Timezone)The time zone should not be fixed to UTC+8. (#37294)
## Proposed changes It is generally more reasonable to use the system's default time zone rather than binding the default time zone to UTC+8. This approach ensures that the application will behave correctly in different environments and regions. **For countries that observe DST, this might require extra attention.**
1 parent 5a8b4b3 commit c58929a

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ public class TimeUtils {
8686
public static Date MAX_DATETIME = null;
8787

8888
static {
89-
TIME_ZONE = ZoneId.of("UTC+8");
90-
9189
Map<String, String> timeZoneMap = Maps.newHashMap();
9290
timeZoneMap.putAll(ZoneId.SHORT_IDS);
9391

@@ -98,7 +96,7 @@ public class TimeUtils {
9896
timeZoneMap.put("GMT", UTC_TIME_ZONE);
9997

10098
timeZoneAliasMap = ImmutableMap.copyOf(timeZoneMap);
101-
99+
TIME_ZONE = getSystemTimeZone().toZoneId();
102100
DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
103101
DATE_FORMAT.withZone(TIME_ZONE);
104102

fe/fe-core/src/test/java/org/apache/doris/common/util/TimeUtilsTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ public void testNormal() {
5959
Assert.assertNotNull(TimeUtils.getCurrentFormatTime());
6060
Assert.assertNotNull(TimeUtils.getStartTimeMs());
6161
Assert.assertTrue(TimeUtils.getElapsedTimeMs(0L) > 0);
62-
63-
Assert.assertEquals(-62135625600000L, TimeUtils.MIN_DATE.getTime());
64-
Assert.assertEquals(253402185600000L, TimeUtils.MAX_DATE.getTime());
65-
Assert.assertEquals(-62135625600000L, TimeUtils.MIN_DATETIME.getTime());
66-
Assert.assertEquals(253402271999000L, TimeUtils.MAX_DATETIME.getTime());
6762
}
6863

6964
@Test

0 commit comments

Comments
 (0)