Example usage for java.util TimeZone setDefault

List of usage examples for java.util TimeZone setDefault

Introduction

In this page you can find the example usage for java.util TimeZone setDefault.

Prototype

public static void setDefault(TimeZone zone) 

Source Link

Document

Sets the TimeZone that is returned by the getDefault method.

Usage

From source file:net.audumla.astronomy.algorithims.AstronomicalTest.java

@Test
public void testSunrise() throws Exception {

    TimeZone.setDefault(TimeZone.getTimeZone("Australia/Melbourne"));
    JulianDate CalcDate = new JulianDate(2009, 8, 8, true);
    double JD = CalcDate.julian();
    EllipticalObject ao = new Sun();
    EllipticalPlanetaryDetails aoDetails = Elliptical.calculate(JD - 1, ao);
    double Alpha1 = aoDetails.ApparentGeocentricRA;
    double Delta1 = aoDetails.ApparentGeocentricDeclination;
    aoDetails = Elliptical.calculate(JD, ao);
    double Alpha2 = aoDetails.ApparentGeocentricRA;
    double Delta2 = aoDetails.ApparentGeocentricDeclination;
    aoDetails = Elliptical.calculate(JD + 1, ao);
    double Alpha3 = aoDetails.ApparentGeocentricRA;
    double Delta3 = aoDetails.ApparentGeocentricDeclination;

    Geolocation.Location loc = new Geolocation.Location(-37.70461920, 145.1030275, 0.0);

    JulianTransitDetails RiseTransitSetTime = RiseTransitSet.calculate(JD, Alpha1, Delta1, Alpha2, Delta2,
            Alpha3, Delta3, loc.getLongitude(Geolocation.Direction.WEST),
            loc.getLatitude(Geolocation.Direction.NORTH), -6);

    java.util.Date rise = RiseTransitSetTime.getJulianRise().toDate();
    java.util.Date set = RiseTransitSetTime.getJulianSet().toDate();

    logger.debug("Melbourne - Julian");
    logger.debug("Date    : " + new JulianDate(JD, true).toDate());
    logger.debug("Julian  : " + JD);
    logger.debug("Sunrise : Algorithms: " + rise + " : " + rise.getTime());
    logger.debug("Sunset  : Algorithms: " + set + " : " + set.getTime());

    Assert.assertEquals(rise.getTime(), 1249764251677l, 1000);
    Assert.assertEquals(set.getTime(), 1249718740677l, 1000);

}

From source file:org.kuali.student.git.tools.merge.TestGitImporterOnKualiStudentDumpFiles.java

@Before
public void onBefore() {
    defaultTimeZone = TimeZone.getDefault();

    TimeZone.setDefault(TimeZone.getTimeZone("America/New_York"));

    defaultDateTimeZone = DateTimeZone.getDefault();
    DateTimeZone.setDefault(DateTimeZone.forID("America/New_York"));
}

From source file:com.github.rnewson.couchdb.lucene.DocumentConverterTest.java

@After
public void teardown() {
    TimeZone.setDefault(tz);
    Context.exit();
}

From source file:org.archive.wayback.webapp.RequestFilter.java

public void init(FilterConfig config) throws ServletException {

    LOGGER.info("Wayback Filter initializing...");
    TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
    try {/*from  www.j a v a 2s. c om*/
        mapper = new RequestMapper(config.getServletContext());
    } catch (ConfigurationException e) {
        throw new ServletException(e.getMessage());
    }
    LOGGER.info("Wayback Filter initialization complete.");
}

From source file:org.apache.apex.malhar.sql.sample.FusionStyleSQLApplicationTest.java

@After
public void tearDown() throws Exception {
    kafka.stop();

    TimeZone.setDefault(defaultTZ);
}

From source file:org.kuali.student.git.tools.merge.TestGitImporterOnKualiStudentDumpFiles.java

@After
public void onAfter() {
    TimeZone.setDefault(defaultTimeZone);
    DateTimeZone.setDefault(defaultDateTimeZone);
}

From source file:helper.util.DateHelper.java

/**
 * Set the default time zone when usint libraries that peform
 * new Date() calls or Calendar.getInstance() calls,
 * and the TimeZone is relevant for user local time calenar based calculartions,
 * or for date formatting//from w  ww  .  j a  va  2  s  . c o m
 **/
public static void setDefaultTimeZone() {
    TimeZone.setDefault(UTC_TIME_ZONE);
}

From source file:org.apache.apex.malhar.sql.sample.PureStyleSQLApplicationTest.java

@After
public void tearDown() throws Exception {
    kafka.stop();
    TimeZone.setDefault(defaultTZ);
}

From source file:org.apache.apex.malhar.sql.FileEndpointTest.java

@Before
public void setUp() throws Exception {
    defaultTZ = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("GMT"));

    outputFolder += testName.getMethodName() + "/";
}

From source file:ca.uhn.hl7v2.model.primitive.CommonTSTest.java

@BeforeClass
public static void setUpBeforeClass() {
    tz = TimeZone.getDefault();//  w w w  .  j ava 2 s.co  m
    TimeZone.setDefault(TimeZone.getTimeZone("Canada/Eastern"));
}