/** * Gets an instance of the JulianChronology in the default time zone. * * @return a chronology in the default time zone */ public static JulianChronology getInstance() { return getInstance(DateTimeZone.getDefault(), 4); }
/** * Gets an instance of the EthiopicChronology in the default time zone. * * @return a chronology in the default time zone */ public static EthiopicChronology getInstance() { return getInstance(DateTimeZone.getDefault(), 4); }
/** * Gets an instance of the IslamicChronology in the default time zone. * * @return a chronology in the default time zone */ public static IslamicChronology getInstance() { return getInstance(DateTimeZone.getDefault(), LEAP_YEAR_16_BASED); }
/** * Gets an instance of the ISOChronology in the default time zone. * * @return a chronology in the default time zone */ public static ISOChronology getInstance() { return getInstance(DateTimeZone.getDefault()); }
/** * Standard instance of a Buddhist Chronology, that matches * Sun's BuddhistCalendar class. This means that it follows the * GregorianJulian calendar rules with a cutover date. */ public static BuddhistChronology getInstance() { return getInstance(DateTimeZone.getDefault()); }
/** * Gets an instance of the GregorianChronology in the default time zone. * * @return a chronology in the default time zone */ public static GregorianChronology getInstance() { return getInstance(DateTimeZone.getDefault(), 4); }
/** * Gets an instance of the CopticChronology in the default time zone. * * @return a chronology in the default time zone */ public static CopticChronology getInstance() { return getInstance(DateTimeZone.getDefault(), 4); }
/** * Gets an instance of the CopticChronology in the default time zone. * * @return a chronology in the default time zone */ public static CopticChronology getInstance() { return getInstance(DateTimeZone.getDefault(), 4); }
@BeforeClass public void setUp() { assertEquals(DateTimeZone.getDefault(), RcFileTester.HIVE_STORAGE_TIME_ZONE); }
@BeforeClass public void setUp() { assertEquals(DateTimeZone.getDefault(), HIVE_STORAGE_TIME_ZONE); }
private void verifyJvmTimeZone() { if (!allowCorruptWritesForTesting && !timeZone.equals(DateTimeZone.getDefault())) { throw new PrestoException(HIVE_TIMEZONE_MISMATCH, format( "To write Hive data, your JVM timezone must match the Hive storage timezone. Add -Duser.timezone=%s to your JVM arguments.", timeZone.getID())); } }
@BeforeClass public void setUp() { assertEquals(DateTimeZone.getDefault(), HIVE_STORAGE_TIME_ZONE); setParquetLogging(); }
private static HivePartition partition(String name) { return parsePartition(TABLE, name, ImmutableList.of(PARTITION_COLUMN_1, PARTITION_COLUMN_2), ImmutableList.of(VARCHAR, BIGINT), DateTimeZone.getDefault()); }
private static long formatDateAsLong(Object object, DateObjectInspector inspector) { if (object instanceof LazyDate) { return ((LazyDate) object).getWritableObject().getDays(); } if (object instanceof DateWritable) { return ((DateWritable) object).getDays(); } // Hive will return java.sql.Date at midnight in JVM time zone long millisLocal = inspector.getPrimitiveJavaObject(object).getTime(); // Convert it to midnight in UTC long millisUtc = DateTimeZone.getDefault().getMillisKeepLocal(DateTimeZone.UTC, millisLocal); // Convert midnight UTC to days return TimeUnit.MILLISECONDS.toDays(millisUtc); }
public Chronology withZone(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } if (zone == getParam()) { return this; } if (zone == DateTimeZone.UTC) { return getBase(); } return new ZonedChronology(getBase(), zone); }
static DateTimeZone nonDefaultTimeZone() { String defaultId = DateTimeZone.getDefault().getID(); for (String id : DateTimeZone.getAvailableIDs()) { if (!id.equals(defaultId)) { DateTimeZone zone = DateTimeZone.forID(id); if (zone.getStandardOffset(0) != 0) { return zone; } } } throw new IllegalStateException("no non-default timezone"); } }
private static void assertConvertPartitionValueToDouble(Type type, String value, double expected) { Object prestoValue = parsePartitionValue(format("p=%s", value), value, type, DateTimeZone.getDefault()).getValue(); assertEquals(convertPartitionValueToDouble(type, prestoValue), expected); }
public Chronology withZone(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } if (zone == DateTimeZone.UTC) { return withUTC(); } if (zone == getZone()) { return this; } return StrictChronology.getInstance(getBase().withZone(zone)); }
public Chronology withZone(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } if (zone == DateTimeZone.UTC) { return withUTC(); } if (zone == getZone()) { return this; } return LenientChronology.getInstance(getBase().withZone(zone)); }
public Chronology withZone(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } if (zone == DateTimeZone.UTC) { return withUTC(); } if (zone == getZone()) { return this; } return StrictChronology.getInstance(getBase().withZone(zone)); }