Re: RFR:JDK-8148849:Truncating Duration
Hi Nadeesh, An internal reviewer pointed out that Duration does not have 'fields' (it is not a TemporalAccessor) so the description might be clarified by saying: + * Truncating the duration returns a copy of the original with *conceptual *fields + * smaller than the specified unit set to zero. The rest is fine. Reviewed Thanks, Roger On 3/30/2016 9:33 AM, Stephen Colebourne wrote: Yes, that looks OK now. thanks Stephen On 30 March 2016 at 12:25, nadeesh tvwrote: Hi Stephen, Thanks for the comments. Please see the updated webrev http://cr.openjdk.java.net/~ntv/8148849/webrev.01/ Made a change in unit == ChronoUnit.SECONDS also Regards, Nadeesh TV On 3/29/2016 6:10 PM, Stephen Colebourne wrote: We're almost there, but looking at the tests, it looks like the behaviour is wrong: The intended behaviour is that -20.5mins (minus 20 minutes 30 secs) should truncate to -20mins -2.1secs truncate to -2secs Note that the truncation is different to Instant here. An Instant truncates towards the far past - like RoundingMode.FLOOR A Duration truncates towards the zero - like RoundingMode.DOWN Stephen On 29 March 2016 at 13:18, nadeesh tv wrote: Hi all, Bug Id : https://bugs.openjdk.java.net/browse/JDK-8148849 Enhanced Duration by adding public Duration truncatedTo(TemporalUnit unit) Please http://cr.openjdk.java.net/~ntv/8148849/webrev.00/ -- Thanks and Regards, Nadeesh TV -- Thanks and Regards, Nadeesh TV
Re: RFR:JDK-8148849:Truncating Duration
Hi, I need one more review for this change Regards, Nadeesh On 3/30/2016 7:03 PM, Stephen Colebourne wrote: Yes, that looks OK now. thanks Stephen On 30 March 2016 at 12:25, nadeesh tvwrote: Hi Stephen, Thanks for the comments. Please see the updated webrev http://cr.openjdk.java.net/~ntv/8148849/webrev.01/ Made a change in unit == ChronoUnit.SECONDS also Regards, Nadeesh TV On 3/29/2016 6:10 PM, Stephen Colebourne wrote: We're almost there, but looking at the tests, it looks like the behaviour is wrong: The intended behaviour is that -20.5mins (minus 20 minutes 30 secs) should truncate to -20mins -2.1secs truncate to -2secs Note that the truncation is different to Instant here. An Instant truncates towards the far past - like RoundingMode.FLOOR A Duration truncates towards the zero - like RoundingMode.DOWN Stephen On 29 March 2016 at 13:18, nadeesh tv wrote: Hi all, Bug Id : https://bugs.openjdk.java.net/browse/JDK-8148849 Enhanced Duration by adding public Duration truncatedTo(TemporalUnit unit) Please http://cr.openjdk.java.net/~ntv/8148849/webrev.00/ -- Thanks and Regards, Nadeesh TV -- Thanks and Regards, Nadeesh TV -- Thanks and Regards, Nadeesh TV
Re: RFR:JDK-8148849:Truncating Duration
Yes, that looks OK now. thanks Stephen On 30 March 2016 at 12:25, nadeesh tvwrote: > > Hi Stephen, > > Thanks for the comments. > Please see the updated webrev > http://cr.openjdk.java.net/~ntv/8148849/webrev.01/ > > Made a change in unit == ChronoUnit.SECONDS also > > > Regards, > Nadeesh TV > > > On 3/29/2016 6:10 PM, Stephen Colebourne wrote: >> >> We're almost there, but looking at the tests, it looks like the >> behaviour is wrong: >> >> The intended behaviour is that >> -20.5mins (minus 20 minutes 30 secs) should truncate to -20mins >> -2.1secs truncate to -2secs >> >> Note that the truncation is different to Instant here. >> An Instant truncates towards the far past - like RoundingMode.FLOOR >> A Duration truncates towards the zero - like RoundingMode.DOWN >> >> Stephen >> >> >> On 29 March 2016 at 13:18, nadeesh tv wrote: >>> >>> Hi all, >>> >>> Bug Id : https://bugs.openjdk.java.net/browse/JDK-8148849 >>> >>> Enhanced Duration by adding public Duration truncatedTo(TemporalUnit >>> unit) >>> >>> Please http://cr.openjdk.java.net/~ntv/8148849/webrev.00/ >>> >>> -- >>> Thanks and Regards, >>> Nadeesh TV >>> > > -- > Thanks and Regards, > Nadeesh TV >
Re: RFR:JDK-8148849:Truncating Duration
Hi Stephen, Thanks for the comments. Please see the updated webrev http://cr.openjdk.java.net/~ntv/8148849/webrev.01/ Made a change in unit == ChronoUnit.SECONDS also Regards, Nadeesh TV On 3/29/2016 6:10 PM, Stephen Colebourne wrote: We're almost there, but looking at the tests, it looks like the behaviour is wrong: The intended behaviour is that -20.5mins (minus 20 minutes 30 secs) should truncate to -20mins -2.1secs truncate to -2secs Note that the truncation is different to Instant here. An Instant truncates towards the far past - like RoundingMode.FLOOR A Duration truncates towards the zero - like RoundingMode.DOWN Stephen On 29 March 2016 at 13:18, nadeesh tvwrote: Hi all, Bug Id : https://bugs.openjdk.java.net/browse/JDK-8148849 Enhanced Duration by adding public Duration truncatedTo(TemporalUnit unit) Please http://cr.openjdk.java.net/~ntv/8148849/webrev.00/ -- Thanks and Regards, Nadeesh TV -- Thanks and Regards, Nadeesh TV
Re: RFR:JDK-8148849:Truncating Duration
We're almost there, but looking at the tests, it looks like the behaviour is wrong: The intended behaviour is that -20.5mins (minus 20 minutes 30 secs) should truncate to -20mins -2.1secs truncate to -2secs Note that the truncation is different to Instant here. An Instant truncates towards the far past - like RoundingMode.FLOOR A Duration truncates towards the zero - like RoundingMode.DOWN Stephen On 29 March 2016 at 13:18, nadeesh tvwrote: > Hi all, > > Bug Id : https://bugs.openjdk.java.net/browse/JDK-8148849 > > Enhanced Duration by adding public Duration truncatedTo(TemporalUnit unit) > > Please http://cr.openjdk.java.net/~ntv/8148849/webrev.00/ > > -- > Thanks and Regards, > Nadeesh TV >
RFR:JDK-8148849:Truncating Duration
Hi all, Bug Id : https://bugs.openjdk.java.net/browse/JDK-8148849 Enhanced Duration by adding public Duration truncatedTo(TemporalUnit unit) Please http://cr.openjdk.java.net/~ntv/8148849/webrev.00/ -- Thanks and Regards, Nadeesh TV