[ 
https://issues.apache.org/jira/browse/GOBBLIN-1885?focusedWorklogId=877111&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-877111
 ]

ASF GitHub Bot logged work on GOBBLIN-1885:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Aug/23 02:12
            Start Date: 19/Aug/23 02:12
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #3747:
URL: https://github.com/apache/gobblin/pull/3747#discussion_r1299007078


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java:
##########
@@ -467,6 +467,18 @@ protected static String 
jobSchedulerTracePrefixBuilder(Properties jobProps) {
         jobProps.getProperty(ConfigurationKeys.FLOW_GROUP_KEY, "<<no flow 
group>>"));
   }
 
+  /**
+   * Takes a given Date object and converts the timezone to UTC before 
returning the number of millseconds since epoch
+   * @param date
+   */
+  public static long getMillisecondsSinceEpochInUTC(Date date) {
+    // Create a Calendar object and set it to the given Date
+    Calendar calendar = Calendar.getInstance();
+    calendar.setTime(date);
+    calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
+    return calendar.getTimeInMillis();
+  }

Review Comment:
   let's opt for the modern, Joda/`java.time` classes.  I believe something 
like:
   ```
   ZonedDateTime.of(
       LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()), 
       ZoneOffset.UTC
   ).toInstant().toEpochMilli()
   ```
   
   nit: this is not a accessor (`get`), but a conversion, so `asUTCEpochMillis`





Issue Time Tracking
-------------------

    Worklog Id:     (was: 877111)
    Time Spent: 20m  (was: 10m)

> Unify Timezones of Scheduler Trigger Tracing logs to UTC
> --------------------------------------------------------
>
>                 Key: GOBBLIN-1885
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1885
>             Project: Apache Gobblin
>          Issue Type: Bug
>          Components: gobblin-service
>            Reporter: Urmi Mustafi
>            Assignee: Abhishek Tiwari
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Ensure all logs are in UTC for ease of comparison between other logging done.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to