Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public class TimeConversionUtilsTest {

// 0.999999999 seconds (1 second - 1 nano) - we need to subtract the nano or the Duration would
// overflow otherwise
final long MAX_DURATION_NANOS = 1 * 1000 * 1000 * 1000 - 1;
final long MAX_DURATION_NANOS =
1 * 1000 /*=1 micro*/ * 1000 /*=1 milli*/ * 1000 /*=1 second*/ - 1;

// Arbitrary durations/instants to confirm conversion works as expected
final org.threeten.bp.Duration ttDuration = org.threeten.bp.Duration.ofMillis(123);
Expand Down Expand Up @@ -96,8 +97,7 @@ void testToJavaTimeInstant_bigInput_doesNotOverflow() {
@Test
void testToThreeteenDuration_bigInput_doesNotOverflow() {
// we use the max long value for the seconds part and an arbitrary int for the nanos part, so we
// can confirm
// that both components are preserved
// can confirm that both components are preserved
java.time.Duration jtDuration =
java.time.Duration.ofSeconds(Long.MAX_VALUE, MAX_DURATION_NANOS);
org.threeten.bp.Duration ttDuration = TimeConversionUtils.toThreetenDuration(jtDuration);
Expand All @@ -108,8 +108,7 @@ void testToThreeteenDuration_bigInput_doesNotOverflow() {
@Test
void testToJavaTimeDuration_bigInput_doesNotOverflow() {
// we use the max long value for the seconds part and an arbitrary int for the nanos part, so we
// can confirm
// that both components are preserved
// can confirm that both components are preserved
org.threeten.bp.Duration ttDuration =
org.threeten.bp.Duration.ofSeconds(Long.MAX_VALUE, MAX_DURATION_NANOS);
java.time.Duration jtDuration = TimeConversionUtils.toJavaTimeDuration(ttDuration);
Expand Down