/** * Gets the chronology, which is the GJChronology if a GregorianCalendar is used, * BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. * The time zone specified is used in preference to that on the calendar. * * @param object the Calendar to convert, must not be null * @param zone the specified zone to use, null means default zone * @return the chronology, never null * @throws NullPointerException if the object is null * @throws ClassCastException if the object is an invalid type */ public Chronology getChronology(Object object, DateTimeZone zone) { if (object.getClass().getName().endsWith(".BuddhistCalendar")) { return BuddhistChronology.getInstance(zone); } else if (object instanceof GregorianCalendar) { GregorianCalendar gc = (GregorianCalendar) object; long cutover = gc.getGregorianChange().getTime(); if (cutover == Long.MIN_VALUE) { return GregorianChronology.getInstance(zone); } else if (cutover == Long.MAX_VALUE) { return JulianChronology.getInstance(zone); } else { return GJChronology.getInstance(zone, cutover, 4); } } else { return ISOChronology.getInstance(zone); } }
/** * Gets the chronology, which is the GJChronology if a GregorianCalendar is used, * BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. * The time zone specified is used in preference to that on the calendar. * * @param object the Calendar to convert, must not be null * @param zone the specified zone to use, null means default zone * @return the chronology, never null * @throws NullPointerException if the object is null * @throws ClassCastException if the object is an invalid type */ public Chronology getChronology(Object object, DateTimeZone zone) { if (object.getClass().getName().endsWith(".BuddhistCalendar")) { return BuddhistChronology.getInstance(zone); } else if (object instanceof GregorianCalendar) { GregorianCalendar gc = (GregorianCalendar) object; long cutover = gc.getGregorianChange().getTime(); if (cutover == Long.MIN_VALUE) { return GregorianChronology.getInstance(zone); } else if (cutover == Long.MAX_VALUE) { return JulianChronology.getInstance(zone); } else { return GJChronology.getInstance(zone, cutover, 4); } } else { return ISOChronology.getInstance(zone); } }
/** * Gets the chronology, which is the GJChronology if a GregorianCalendar is used, * BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. * The time zone specified is used in preference to that on the calendar. * * @param object the Calendar to convert, must not be null * @param zone the specified zone to use, null means default zone * @return the chronology, never null * @throws NullPointerException if the object is null * @throws ClassCastException if the object is an invalid type */ public Chronology getChronology(Object object, DateTimeZone zone) { if (object.getClass().getName().endsWith(".BuddhistCalendar")) { return BuddhistChronology.getInstance(zone); } else if (object instanceof GregorianCalendar) { GregorianCalendar gc = (GregorianCalendar) object; long cutover = gc.getGregorianChange().getTime(); if (cutover == Long.MIN_VALUE) { return GregorianChronology.getInstance(zone); } else if (cutover == Long.MAX_VALUE) { return JulianChronology.getInstance(zone); } else { return GJChronology.getInstance(zone, cutover, 4); } } else { return ISOChronology.getInstance(zone); } }
/** * Gets the chronology, which is the GJChronology if a GregorianCalendar is used, * BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. * The time zone specified is used in preference to that on the calendar. * * @param object the Calendar to convert, must not be null * @param zone the specified zone to use, null means default zone * @return the chronology, never null * @throws NullPointerException if the object is null * @throws ClassCastException if the object is an invalid type */ public Chronology getChronology(Object object, DateTimeZone zone) { if (object.getClass().getName().endsWith(".BuddhistCalendar")) { return BuddhistChronology.getInstance(zone); } else if (object instanceof GregorianCalendar) { GregorianCalendar gc = (GregorianCalendar) object; long cutover = gc.getGregorianChange().getTime(); if (cutover == Long.MIN_VALUE) { return GregorianChronology.getInstance(zone); } else if (cutover == Long.MAX_VALUE) { return JulianChronology.getInstance(zone); } else { return GJChronology.getInstance(zone, cutover, 4); } } else { return ISOChronology.getInstance(zone); } }
Date time1, time2, time3, time4; [...] GregorianCalendar difference12 = new GregorianCalendar(0,0,0,0,0); difference12.set(GregorianCalendar.MILLISECNOD, time1.getTime() - time2.getTime()); GregorianCalendar difference34 = new GregorianCalendar(0,0,0,0,0); difference12.add(GregorianCalendar.MILLISECNOD, time3.getTime() - time4.getTime()); Date diff12 = difference12.getGregorianChange(); Date diff34 = difference34.getGregorianChange(); GregorianCalendar sum = new GregorianCalendar(0,0,0,0,0); sum.add(GregorianCalendar.MILLISECOND, diff12.getTime() - time34.getTime());
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
private static BigInteger clockValueNow() { GregorianCalendar now = new GregorianCalendar(); BigInteger nowMillis = BigInteger.valueOf(now.getTime().getTime()); BigInteger baseMillis = BigInteger.valueOf(now.getGregorianChange().getTime()); return (nowMillis.subtract(baseMillis).multiply(BigInteger.valueOf(10000L))); }
public void write (Kryo kryo, Output output, Calendar object) { timeZoneSerializer.write(kryo, output, object.getTimeZone()); // can't be null output.writeLong(object.getTimeInMillis(), true); output.writeBoolean(object.isLenient()); output.writeInt(object.getFirstDayOfWeek(), true); output.writeInt(object.getMinimalDaysInFirstWeek(), true); if (object instanceof GregorianCalendar) output.writeLong(((GregorianCalendar)object).getGregorianChange().getTime(), false); else output.writeLong(DEFAULT_GREGORIAN_CUTOVER, false); }
public void write (Kryo kryo, Output output, Calendar object) { timeZoneSerializer.write(kryo, output, object.getTimeZone()); // can't be null output.writeLong(object.getTimeInMillis(), true); output.writeBoolean(object.isLenient()); output.writeInt(object.getFirstDayOfWeek(), true); output.writeInt(object.getMinimalDaysInFirstWeek(), true); if (object instanceof GregorianCalendar) output.writeLong(((GregorianCalendar)object).getGregorianChange().getTime(), false); else output.writeLong(DEFAULT_GREGORIAN_CUTOVER, false); }
public void write (Kryo kryo, Output output, Calendar object) { timeZoneSerializer.write(kryo, output, object.getTimeZone()); // can't be null output.writeLong(object.getTimeInMillis(), true); output.writeBoolean(object.isLenient()); output.writeInt(object.getFirstDayOfWeek(), true); output.writeInt(object.getMinimalDaysInFirstWeek(), true); if (object instanceof GregorianCalendar) output.writeLong(((GregorianCalendar)object).getGregorianChange().getTime(), false); else output.writeLong(DEFAULT_GREGORIAN_CUTOVER, false); }
public void write (Kryo kryo, Output output, Calendar object) { timeZoneSerializer.write(kryo, output, object.getTimeZone()); // can't be null output.writeLong(object.getTimeInMillis(), true); output.writeBoolean(object.isLenient()); output.writeInt(object.getFirstDayOfWeek(), true); output.writeInt(object.getMinimalDaysInFirstWeek(), true); if (object instanceof GregorianCalendar) output.writeLong(((GregorianCalendar)object).getGregorianChange().getTime(), false); else output.writeLong(DEFAULT_GREGORIAN_CUTOVER, false); }