Repository: incubator-eagle Updated Branches: refs/heads/master 3e09327bb -> 82b1c2249
[Minor] : DateTimeUtil not to depend on hadoop configuration jar Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/82b1c224 Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/82b1c224 Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/82b1c224 Branch: refs/heads/master Commit: 82b1c2249f9edd02b0a2f00bdcc55c4d265e7e6a Parents: 3e09327 Author: Ralph, Su <suliang...@gmail.com> Authored: Thu Nov 3 23:19:29 2016 +0800 Committer: Ralph, Su <suliang...@gmail.com> Committed: Thu Nov 3 23:19:29 2016 +0800 ---------------------------------------------------------------------- .../main/java/org/apache/eagle/common/DateTimeUtil.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/82b1c224/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java index bd97aa8..c21d2bc 100644 --- a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java +++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java @@ -16,7 +16,9 @@ */ package org.apache.eagle.common; -import org.apache.eagle.common.config.EagleConfigFactory; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import org.apache.eagle.common.config.EagleConfigConstants; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -33,8 +35,12 @@ public class DateTimeUtil { public static final long ONEMINUTE = 1L * 60L * 1000L; public static final long ONEHOUR = 1L * 60L * 60L * 1000L; public static final long ONEDAY = 24L * 60L * 60L * 1000L; - private static TimeZone CURRENT_TIME_ZONE = EagleConfigFactory.load().getTimeZone(); - //private static TimeZone CURRENT_TIME_ZONE = TimeZone.getDefault(); + private static TimeZone CURRENT_TIME_ZONE; + static { + Config config = ConfigFactory.load(); + CURRENT_TIME_ZONE = TimeZone.getTimeZone((config.hasPath(EagleConfigConstants.EAGLE_TIME_ZONE) + ? config.getString(EagleConfigConstants.EAGLE_TIME_ZONE) : EagleConfigConstants.DEFAULT_EAGLE_TIME_ZONE)); + } public static Date humanDateToDate(String date) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");