[threeten-dev] 64bit tzdata?
Xueming Shen
xueming.shen at oracle.com
Tue Dec 18 11:57:30 PST 2012
I think threeten tzdata does not have the limitation that existing jdk
does. Though it tries to avoiding the "long" if possible. Code below
is used to read in and write out the spoch sec of the date/time of the
transition.
static void writeEpochSec(long epochSec, DataOutput out) throws IOException {
if (epochSec >= -4575744000L && epochSec < 10413792000L && epochSec % 900 == 0) { // quarter hours between 1825 and 2300
int store = (int) ((epochSec + 4575744000L) / 900);
out.writeByte((store >>> 16) & 255);
out.writeByte((store >>> 8) & 255);
out.writeByte(store & 255);
} else {
out.writeByte(255);
out.writeLong(epochSec);
}
}
static long readEpochSec(DataInput in) throws IOException {
int hiByte = in.readByte() & 255;
if (hiByte == 255) {
return in.readLong();
} else {
int midByte = in.readByte() & 255;
int loByte = in.readByte() & 255;
long tot = ((hiByte << 16) + (midByte << 8) + loByte);
return (tot * 900) - 4575744000L;
}
}
On 12/18/2012 11:14 AM, yoshito_umaoka at us.ibm.com wrote:
> Hi all,
>
> As far as I know, current Java releases use 32bit tzdata (effective
> between 1901-12-13T20:45:52Z and 2038-01-19T03:14:07Z) and offsets
> returned by java.util.TimeZone for dates before 1900 does not match the tz
> database in many cases.
> Does JSR-310 project introduce 64bit tzdata support?
>
> Thanks,
> Yoshito
More information about the threeten-dev
mailing list