-
Notifications
You must be signed in to change notification settings - Fork 78
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
Provide upperBin and lowerBin signatures that accept Durations #5148
Conversation
@@ -3170,6 +3170,26 @@ public static Instant lowerBin(@Nullable final Instant instant, long intervalNan | |||
return epochNanosToInstant(Numeric.lowerBin(epochNanos(instant), intervalNanos)); | |||
} | |||
|
|||
/** | |||
* Returns an {@link Instant} value, which is at the starting (lower) end of a time range defined by the interval | |||
* nanoseconds. For example, a 5*MINUTE intervalNanos value would return the instant value for the start of the |
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 is also a criticism of the existing javadoc - we're considering epoch nanoseconds as the start of the interval. I do worry a bit generally that there may be some sloppiness around what the user wants and what we calculate, potentially as it relates to leap seconds and such.
For example, are we guaranteed that lowerBin(x, Duration.ofSeconds(1)).equals(x.truncatedTo(ChronoUnit.SECONDS))
? Ditto wrt MICROS, MILLIS, MINUTES, HOURS, HALF_DAYS, DAYS.
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 guess there is still stuff about time that I didn't know.
- Java time does not use UTC, they have their own "Java Time-Scale".
- "Java Time Scale" divides the day into exactly 86400 subdivisions known as seconds. These seconds differ from SI seconds but closely match the "international civil time scale".
- From 1972-11-03 to now, Java Time Scale exactly matches UTC-SLS on days that do not have leap seconds.
- On days that do have leap seconds, the leap second is spread equally over the last 1000 seconds of the day.
Details can be found at: https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html
Given this weirdness, I think the upperBin/lowerBin return what is expected.
Labels indicate documentation is required. Issues for documentation have been opened: Community: https://github.com/deephaven/deephaven.io/issues/3740 |
Provide upperBin and lowerBin signatures that accept Durations.
Resolves #5147