Re: java.time lacks start and end aware period data types

2024-06-19 Thread Stephen Colebourne
There are a variety of ways that a range of the timeline can be defined. And some would argue that Java should have a general purpose Range class to cover all Comparable classes rather than a few specific ones for Java time. Ultimately, Java time chose to avoid the issues by not addressing the

Re: Instant.now(Clock) and InstantSource

2024-06-04 Thread Stephen Colebourne
On Mon, 3 Jun 2024 at 22:25, Kurt Alfred Kluever wrote: > It feels a bit strange that you can't pass an `InstantSource` to > `Instant.now(...)`, but you _can_ pass a `Clock` (which of course has a > "useless" `ZoneId` when creating an `Instant`). Therefore, I'd like to > propose one of the

Re: In support of Instant.minus(Instant)

2024-05-16 Thread Stephen Colebourne
e_space#Definition>, with >> >>> instants the points and durations the vectors. (An affine space is >> >>> a vector space without a distinguished origin, which of course >> >>> Instants don't have.) It is 100% standard to use the minus sign fo

Re: In support of Instant.minus(Instant)

2024-05-02 Thread Stephen Colebourne
On Thu, 2 May 2024 at 15:58, Kurt Alfred Kluever wrote: > instant − instant = duration // what we're discussing > instant + duration = instant // satisfied by instant.plus(duration) > instant - duration = instant // satisfied by instant.minus(duration) > duration + duration = duration //

Re: RFR: 8331202: Support for Duration until another Instant [v2]

2024-04-30 Thread Stephen Colebourne
On Mon, 29 Apr 2024 21:32:16 GMT, Naoto Sato wrote: >> A new method on Instant to return the duration `until` another Instant is >> suggested per the following discussion thread: >> >> https://mail.openjdk.org/pipermail/core-libs-dev/2024-April/122131.html >> >> A CSR has also been drafted. >

Re: In support of Instant.minus(Instant)

2024-04-25 Thread Stephen Colebourne
java.time.* already has the `until(ChronoLocalDate)` method on LocalDate. It would be reasonable to add a similar method to various other classes. This potentially gives you Duration dur = start.until(end) I'm wary of adding the opposite (given until() is already there). I'm particularly wary

Re: RFR: 8313231: Redundant if statement in ZoneInfoFile

2023-07-31 Thread Stephen Colebourne
On Thu, 27 Jul 2023 06:46:46 GMT, John Jiang wrote: > if (i < savingsInstantTransitions.length) { > // javazic writes the last GMT offset into index 0! > if (i < savingsInstantTransitions.length) { > offsets[0] = standardOffsets[standardOffsets.length - 1] * 1000; >

Re: RFR: 8313231: Redundant if statement in ZoneInfoFile

2023-07-31 Thread Stephen Colebourne
On Thu, 27 Jul 2023 11:01:23 GMT, Pavel Rappo wrote: >> if (i < savingsInstantTransitions.length) { >> // javazic writes the last GMT offset into index 0! >> if (i < savingsInstantTransitions.length) { >> offsets[0] = standardOffsets[standardOffsets.length - 1] * 1000; >>

Re: RFR: 8310033: Clarify return value of Java Time compareTo methods [v9]

2023-07-21 Thread Stephen Colebourne
On Fri, 21 Jul 2023 15:59:42 GMT, Roger Riggs wrote: >> In java.time packages, clarify timeline order javadoc to mention "before" >> and "after" in the value of the `compareTo` method return values. >> Add javadoc @see tags to isBefore and isAfter methods >> >> Replace use of "negative" and

Re: RFR: 8310033: Clarify return value of Java Time compareTo methods [v7]

2023-07-20 Thread Stephen Colebourne
On Tue, 11 Jul 2023 17:54:23 GMT, Roger Riggs wrote: >> In java.time packages, clarify timeline order javadoc to mention "before" >> and "after" in the value of the `compareTo` method return values. >> Add javadoc @see tags to isBefore and isAfter methods >> >> Replace use of "negative" and

Re: RFR: 8310033: Clarify return value of Java Time compareTo methods [v2]

2023-06-18 Thread Stephen Colebourne
On Fri, 16 Jun 2023 22:12:43 GMT, Roger Riggs wrote: >> In java.time packages, clarify timeline order javadoc to mention "before" >> and "after" in the value of the `compareTo` method return values. >> Add javadoc @see tags to isBefore and isAfter methods >> >> Replace use of "negative" and

Re: RFR: 8307466: java.time.Instant calculation bug in until and between methods

2023-05-06 Thread Stephen Colebourne
On Fri, 5 May 2023 21:28:25 GMT, Roger Riggs wrote: > The implementation of java.time.Instant.until(I2, ChronoUnit) in some cases > did not correctly borrow or carry from the nanos to the seconds when > computing using ChronoUnit.MILLIS or ChronoUnit.MICROS. > The errant computation was

Re: Time difference calculation bug

2023-05-03 Thread Stephen Colebourne
This looks like a bug from the description below, although it is surprising that it isn't caught by tests. Stephen On Wed, 3 May 2023, 21:47 SHARPE, Stuart (Commercial & Institutional CDIO), wrote: > Hi Roger, > > Thanks for the reply. > > I must admit I am struggling to understand your

Re: RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v4]

2023-02-02 Thread Stephen Colebourne
On Wed, 1 Feb 2023 20:19:20 GMT, cheenar wrote: >> test/jdk/java/time/tck/java/time/zone/TCKFixedZoneRules.java line 141: >> >>> 139: @Test(dataProvider="rules") >>> 140: public void test_isValidOffset_LDT_ZO(ZoneRules test, ZoneOffset >>> expectedOffset) { >>> 141: if