[threeten-dev] Instant.MIN/MAX, LocalDate.MIN/MAX and Year.MIN/MAX_VALUE

Stephen Colebourne scolebourne at joda.org
Sat Apr 6 15:30:22 PDT 2013


All looks fine to me.
Stephen
On 6 Apr 2013 08:12, "Xueming Shen" <xueming.shen at oracle.com> wrote:

> Stephen,
>
> Webrev has been updated to saturate correctly. Is the calculation correct?
>
> http://cr.openjdk.java.net/~**sherman/jdk8_threeten/**
> filetime/src/share/classes/**java/nio/file/attribute/**
> FileTime.java.sdiff.html<http://cr.openjdk.java.net/~sherman/jdk8_threeten/filetime/src/share/classes/java/nio/file/attribute/FileTime.java.sdiff.html>
>
> -Sherman
>
>>
>>  Here is the "draft" of the FileTime change, comment and suggestion
>>>> appreciated.
>>>>
>>>> http://cr.openjdk.java.net/~**sherman/jdk8_threeten/**filetime/<http://cr.openjdk.java.net/~sherman/jdk8_threeten/filetime/>
>>>>
>>> to(TimeUnit unit)
>>> unit.convert(instant.**getEpochSecond(), TimeUnit.SECONDS) +
>>> unit.convert(instant.getNano()**, TimeUnit.NANOSECONDS);
>>> will not saturate correctly to MIN/MAX
>>>
>>> toMillis()
>>> instant.toEpochMilli(); will throw ArithmeticException, so you'll have
>>> to catch and convert to MIN/MAX.
>>>
>>>
>


More information about the threeten-dev mailing list