private void setDefaultTimeZone() {
   String dtzStr = pc.getProperties().getProperty("pig.datetime.default.tz");
   if (dtzStr != null && dtzStr.length() > 0) {
     currentDTZ = DateTimeZone.getDefault();
     DateTimeZone.setDefault(DateTimeZone.forID(dtzStr));
   }
 }
Ejemplo n.º 2
0
 protected void tearDown() throws Exception {
   DateTimeUtils.setCurrentMillisSystem();
   DateTimeZone.setDefault(originalDateTimeZone);
   TimeZone.setDefault(originalTimeZone);
   Locale.setDefault(originalLocale);
   originalDateTimeZone = null;
   originalTimeZone = null;
   originalLocale = null;
 }
Ejemplo n.º 3
0
 protected void setUp() throws Exception {
   DateTimeUtils.setCurrentMillisFixed(TEST_TIME_NOW);
   originalDateTimeZone = DateTimeZone.getDefault();
   originalTimeZone = TimeZone.getDefault();
   originalLocale = Locale.getDefault();
   DateTimeZone.setDefault(LONDON);
   TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
   Locale.setDefault(Locale.UK);
 }
 @Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (action.equals(Intent.ACTION_LOCALE_CHANGED)
       || action.equals(Intent.ACTION_TIME_CHANGED)
       || action.equals(Intent.ACTION_DATE_CHANGED)
       || action.equals(Intent.ACTION_TIMEZONE_CHANGED)) {
     DateTimeZone.setDefault(DateTimeZone.forID(TimeZone.getDefault().getID()));
     EventAppWidgetProvider.updateAllWidgets(context);
   }
   EventAppWidgetProvider.updateEventList(context);
 }
Ejemplo n.º 5
0
  protected void setUp() throws Exception {
    DateTimeUtils.setCurrentMillisFixed(TEST_TIME_NOW);
    originalDateTimeZone = DateTimeZone.getDefault();
    originalTimeZone = TimeZone.getDefault();
    originalLocale = Locale.getDefault();
    DateTimeZone.setDefault(DateTimeZone.forID("Europe/London"));
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Locale.setDefault(Locale.UK);

    ISO = ISOChronology.getInstance();
    JULIAN = JulianChronology.getInstance();
  }
Ejemplo n.º 6
0
  @Override
  public Long exec(Tuple input) throws IOException {
    if (input == null || input.size() < 1) {
      return null;
    }

    // Set the time to default or the output is in UTC
    DateTimeZone.setDefault(DateTimeZone.UTC);

    DateTime result = new DateTime(input.get(0).toString());

    return result.getMillis();
  }
Ejemplo n.º 7
0
  public String exec(Tuple input) throws IOException {
    // Set the time to default or the output is in UTC
    DateTimeZone.setDefault(DateTimeZone.UTC);
    DateTime dt = new DateTime((String) input.get(0).toString());

    // Set the month and day to 1 and the hour, minute, second and
    // milliseconds to 0
    DateTime result =
        dt.monthOfYear()
            .setCopy(1)
            .dayOfMonth()
            .setCopy(1)
            .hourOfDay()
            .setCopy(0)
            .minuteOfHour()
            .setCopy(0)
            .secondOfMinute()
            .setCopy(0)
            .millisOfSecond()
            .setCopy(0);

    return result.toString();
  }
Ejemplo n.º 8
0
 @After
 public void after() {
   TimeZone.setDefault(originalTimeZone);
   DateTimeZone.setDefault(DateTimeZone.forTimeZone(originalTimeZone));
 }
Ejemplo n.º 9
0
 @Before
 public void setup() {
   originalTimeZone = TimeZone.getDefault();
   TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
   DateTimeZone.setDefault(DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT")));
 }
 @AfterClass
 public static void afterClass() {
   DateTimeZone.setDefault(defaultZone);
 }
 @BeforeClass
 public static void beforeClass() {
   defaultZone = DateTimeZone.getDefault();
   DateTimeZone.setDefault(DateTimeZone.UTC);
 }
 private void restoreDefaultTimeZone() {
   if (currentDTZ != null) {
     DateTimeZone.setDefault(currentDTZ);
     currentDTZ = null;
   }
 }