This is an automated email from the ASF dual-hosted git repository. kirs pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new fa389f467f7 [Fix](Timezone)The time zone should not be fixed to UTC+8. (#37294) fa389f467f7 is described below commit fa389f467f7ce7a632a730d3a933dff3b1ccb714 Author: Calvin Kirs <k...@apache.org> AuthorDate: Fri Jul 5 14:12:33 2024 +0800 [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.** --- fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java | 4 +--- .../src/test/java/org/apache/doris/common/util/TimeUtilsTest.java | 5 ----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java index ca7501e2f98..fb968db4991 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java @@ -86,8 +86,6 @@ public class TimeUtils { public static Date MAX_DATETIME = null; static { - TIME_ZONE = ZoneId.of("UTC+8"); - Map<String, String> timeZoneMap = Maps.newHashMap(); timeZoneMap.putAll(ZoneId.SHORT_IDS); @@ -98,7 +96,7 @@ public class TimeUtils { timeZoneMap.put("GMT", UTC_TIME_ZONE); timeZoneAliasMap = ImmutableMap.copyOf(timeZoneMap); - + TIME_ZONE = getSystemTimeZone().toZoneId(); DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DATE_FORMAT.withZone(TIME_ZONE); diff --git a/fe/fe-core/src/test/java/org/apache/doris/common/util/TimeUtilsTest.java b/fe/fe-core/src/test/java/org/apache/doris/common/util/TimeUtilsTest.java index a4347c5acaf..114ddada9cd 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/common/util/TimeUtilsTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/common/util/TimeUtilsTest.java @@ -59,11 +59,6 @@ public class TimeUtilsTest { Assert.assertNotNull(TimeUtils.getCurrentFormatTime()); Assert.assertNotNull(TimeUtils.getStartTimeMs()); Assert.assertTrue(TimeUtils.getElapsedTimeMs(0L) > 0); - - Assert.assertEquals(-62135625600000L, TimeUtils.MIN_DATE.getTime()); - Assert.assertEquals(253402185600000L, TimeUtils.MAX_DATE.getTime()); - Assert.assertEquals(-62135625600000L, TimeUtils.MIN_DATETIME.getTime()); - Assert.assertEquals(253402271999000L, TimeUtils.MAX_DATETIME.getTime()); } @Test --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org