-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release/1.16.0 #101
Release/1.16.0 #101
Conversation
This change sets the simpleDateFormat (for local time parsing) to have the GMT time zone. Move GMT timezone name to TimeLibConstants and make public. This is necessary because the function finds the difference between system time (epoch millisecond relative to GMT) to local time ( epoch millisecond relative to GMT). Before setting the default time zone for the JVM, this explicit setting is not necessary. However, after setting the default time zone, the simpleDateFormat will use the default time zone, which is often not GMT. This causes the time difference to be incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you're using the branch release/1.16.0
. The release/*
branches should not be touched by any developer, including all of us, as they are intended to be created automatically by our automation when a tagged release is created.
See GitHub Actions Workflow here: https://github.com/hms-networks/sc-ewon-flexy-extensions-lib/blob/main/.github/workflows/release-make-branch.yml
I'm honestly not sure whether any issues will arise if you merge this PR and tag a release, but in practice, it's just best to avoid using the branch namespace of release/*
entirely. I personally tend to name development branches in the format of dev/1.2.3
or a number related to a related GitHub issue.
- As long as you enable the 'Delete Branch' option when merging this PR, the automation will probably run fine, though.
*/ | ||
public static long convertLocalEpochMillisToUtc(long localEpochMillis) | ||
throws InterruptedException, ParseException { | ||
return localEpochMillis + calculateLocalTimeOffsetMilliseconds(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use getLocalTimeOffsetMilliseconds()
instead?
In its current form, this method would force a local time offset calculation each time it is invoked. If it's being invoked for every historical data EBD response, that can be very expensive performance-wise, and it is unnecessary to update the time offset at such a fast rate (potentially many times a minute).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getLocalTimeOffsetMilliseconds()
uses the last calculated offset - this could be outdated. Here we need a fresh calculation because the offset could have changed due to daylight savings or user setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still seems like a costly operation to perform each time. The name/Javadocs/appearance of the method also does not convey that it is updating the local time offset calculation. Based on the method name and Javadocs, I would expect that this method is just simply converting local epoch millis to UTC.
I understand the intention here, but I wonder whether there is a solution that does not put even further pressure on the already constrained Flexy by adding more EBD calls.
Additionally, this is also circumventing the SCTimeUtils class process for injecting time zone configurations, as well as the newly created TimeZoneManager
class you're adding. It might make sense to align with those classes to ensure that if there is updated time offset information being pulled, we're also accordingly updating the JVM TZ configuration, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are correct the TimeZoneManager class, if used, should maintain the offset.
Right now this method is only called when Rapid Catch up finds data and data point timestamps are local.
I will make the change.
src/main/java/com/hms_networks/americas/sc/extensions/historicaldata/RapidCatchUp.java
Outdated
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/historicaldata/RapidCatchUp.java
Outdated
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/historicaldata/RapidCatchUp.java
Outdated
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataManager.java
Outdated
Show resolved
Hide resolved
.../java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataQueueManager.java
Outdated
Show resolved
Hide resolved
.../java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataQueueManager.java
Outdated
Show resolved
Hide resolved
.../java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataQueueManager.java
Show resolved
Hide resolved
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEBDRequest.java
Outdated
Show resolved
Hide resolved
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEBDRequest.java
Outdated
Show resolved
Hide resolved
aa440da
to
fad8948
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of instances of comments that start with lowercase. I dont recall if this was ever documented but i think it would be more consistent with the rest of the library if they were capitalized.
src/main/java/com/hms_networks/americas/sc/extensions/system/time/TimeZoneManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/system/time/TimeZoneManager.java
Outdated
Show resolved
Hide resolved
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEbdRequest.java
Outdated
Show resolved
Hide resolved
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEbdRequest.java
Outdated
Show resolved
Hide resolved
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEbdRequest.java
Outdated
Show resolved
Hide resolved
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEbdRequest.java
Outdated
Show resolved
Hide resolved
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEbdRequest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good aside from Google Java Format naming violations.
...in/java/com/hms_networks/americas/sc/extensions/historicaldata/HistoricalDataEbdRequest.java
Outdated
Show resolved
Hide resolved
This class is used to create a request for historical data EBD requests.
This method changes locally relative epoch time to a epoch time that is relative to UTC.
Updates include a check to ensure that the RapidCatchUp never looks for data past the current time. When RapidCatchUp finds data in the historical data queue, it will now convert the time to milliseconds since epoch UTC. This requires an understanding of the "Record Data in UTC" setting.
With EBD request building consolidated to HistoricalDataEBDRequest, methods were added that accept the EBD string as a parameter.
Refactor the method getFifoNextSpanDataRaw with the goals of readability and simplicity. Additionally, make use of methods to build EBD requests.
This PR addresses the issue of time zone handling
Additional feature of Instant values EBD call to return instant tag values
closes #98
closes #90