[threeten-dev] [threeten-develop] Supported range for the Instant class
Roger Riggs
Roger.Riggs at oracle.com
Mon Dec 31 06:22:11 PST 2012
Makes sense to me. Fewer special cases and more consistent across the API.
I don't think the JDK is designed/intended specifically to handle
scientific computing
and even the range of LocalDate is unnecessarily large.
For serious scientific computations a full library would handle the
larger range.
On 12/31/2012 8:59 AM, Stephen Colebourne wrote:
> All,
> I am considering reducing the supported range of Instant
>
> The original plan and code supports a range for Instant of the number
> of seconds that can be stored in a Java long. This was partly chosen
> to exceed the estimated age of the universe. Whereas the maximum range
> for LocalDate is just under 1bn years, controlled by the 2bn size of a
> Java int.
>
> Maximum Instant = ~292bn years
> Age of universe = ~13.6bn years
> Maximum LocalDate = 1bn years (999,999,999 years)
>
> The change I am considering is to make the mximum range of an Instant
> match that of LocalDate.
>
> The key negative is that it is no longer possible to represent all
> instants within the age of the universe. But frankly, storing a far,
> far point in the past to nanosecond precision from 1970-01-01 seems
> wrong anyway. Astronomers would prefer to use some kind of BigYear
> class I suspect.
>
> Positives include
> - Duration.between never throws an exception (the duration between any
> two instants will never exceed the range of a duration)
> - No range errors when converting from an Instant to a ZonedDateTime
> - Printing/parsing instants is much simpler (due to previous point)
> - Fewer special/edge cases in general
> - There is one less conceptual min/max in the API
>
> As a side note, this change makes more sense now than it used to as we
> have fully integrated Instant into the Temporal hierarchy.
>
> thoughts/objections?
> Stephen
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122412
> _______________________________________________
> threeten-develop mailing list
> threeten-develop at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/threeten-develop
--
Thanks, Roger
Oracle Java Platform Group
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment
More information about the threeten-dev
mailing list