Menu

DateTimeDurationPrecision

Stephen Colebourne

This choice is about what precision duration fields should use.

Option 1 - int / Integer

This option would see the JSR supply duration classes using int as their precision:

 Duration duration = ...
 int days = duration.getDays();
 int secs = duration.getSeconds();
 int ms = duration.getMillis();   // has to be separate from seconds

Option 2 - BigDecimal

This option would see the JSR supply duration classes using !BigDecimal as their precision:

 Duration duration = ...
 BigDecimal days = duration.getDays();
 BigDecimal secs = duration.getSeconds();   // includes milliseconds

Option 3 - Generics

This option would see the JSR supply duration classes with generics to control their precision:

 Duration<BigDecimal> duration = ...
 BigDecimal days = duration.getDays();
 BigDecimal secs = duration.getSeconds();   // includes milliseconds

 Duration<Integer> duration = ...
 int days = duration.getDays();   // auto-unboxing
 Integer secs = duration.getSeconds();   // milliseconds handling unclear


Related

OldWiki: Historic_choices
OldWiki: ThreeTen

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.