本文整理汇总了Java中org.joda.time.DateTimeZone.setDefault方法的典型用法代码示例。如果您正苦于以下问题:Java DateTimeZone.setDefault方法的具体用法?Java DateTimeZone.setDefault怎么用?Java DateTimeZone.setDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateTimeZone
的用法示例。
在下文中一共展示了DateTimeZone.setDefault方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSetUpInTransaction
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Override
protected void onSetUpInTransaction() throws Exception
{
nodeService = (NodeService)applicationContext.getBean(ServiceRegistry.NODE_SERVICE.getLocalName());
importerService = (ImporterService)applicationContext.getBean(ServiceRegistry.IMPORTER_SERVICE.getLocalName());
importerBootstrap = (ImporterBootstrap)applicationContext.getBean("spacesBootstrap");
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
this.authenticationComponent.setSystemUserAsCurrentUser();
this.versionService = (VersionService)this.applicationContext.getBean("VersionService");
// Create the store
this.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
TimeZone tz = TimeZone.getTimeZone("GMT");
TimeZone.setDefault(tz);
// Joda time has already grabbed the JVM zone so re-set it here
DateTimeZone.setDefault(DateTimeZone.forTimeZone(tz));
}
示例2: setUp
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
/**
* Ensures that the temp locations are cleaned out before the tests start
*/
@Override
public void setUp() throws Exception
{
// Grab the context, which will normally have been
// cached by the ApplicationContextHelper
ctx = MiscContextTestSuite.getMinimalContext();
this.mimetypeMap = (MimetypeMap) ctx.getBean("mimetypeService");
this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService");
// perform a little cleaning up
long now = System.currentTimeMillis();
TempFileProvider.TempFileCleanerJob.removeFiles(now);
TimeZone tz = TimeZone.getTimeZone("GMT");
TimeZone.setDefault(tz);
// Joda time has already grabbed the JVM zone so re-set it here
DateTimeZone.setDefault(DateTimeZone.forTimeZone(tz));
}
示例3: init
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@PostConstruct
public void init() {
// Just to be extra sure
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
DateTimeZone.setDefault(DateTimeZone.UTC);
log.info("System going for boot. Server status: {}", this.serverStatus);
// setServerStatus(ServerStatus.BOOTING);
// statusChangeEvents.fire(ServerStatus.BOOTING);
// use default granularity
triggerDataLoad(0);
}
示例4: testCastTimestampToDate
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Test
public void testCastTimestampToDate() throws Exception {
String[] tzs = {"America/Los_Angeles", "UTC", "Europe/Paris", "Pacific/Auckland", "Australia/Melbourne"};
for (String tz : tzs) {
DateTimeZone.setDefault(DateTimeZone.forID(tz));
testBuilder()
.sqlQuery("SELECT CAST(`datetime0` AS DATE) res1 FROM (VALUES({ts '2016-01-02 00:46:36'})) tbl(datetime0)")
.ordered()
.baselineColumns("res1")
.baselineValues(new LocalDateTime(2016, 1, 2, 0, 0))
.go();
}
}
示例5: stringToTimestampChangeTZ
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Test
public void stringToTimestampChangeTZ() {
DateTimeZone defaultTZ = DateTimeZone.getDefault();
try {
DateTimeZone.setDefault(DateTimeZone.forID("America/Los_Angeles"));
assertEquals(1236478747000L, formatTimeStamp("2009-03-08 02:19:07", getFormatterForFormatString("YYYY-MM-DD HH:MI:SS")));
} finally {
DateTimeZone.setDefault(defaultTZ);
}
}
示例6: stringToTimestampChangeTZOffset
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Test
public void stringToTimestampChangeTZOffset() {
DateTimeZone defaultTZ = DateTimeZone.getDefault();
try {
assertEquals(calculateTime("2008-09-15 10:53:00"), formatTimeStamp("2008-09-15T15:53:00+0500", getFormatterForFormatString("YYYY-MM-DD\"T\"HH24:MI:SSTZO")));
assertEquals(calculateTime("2011-01-01 04:00:00"), formatTimeStamp("2010-12-31T23:00:00-0500", getFormatterForFormatString("YYYY-MM-DD\"T\"HH24:MI:SSTZO")));
assertEquals(calculateTime("2010-12-31 23:00:00"), formatTimeStamp("2010-12-31T23:00:00", getFormatterForFormatString("YYYY-MM-DD\"T\"HH24:MI:SS")));
} finally {
DateTimeZone.setDefault(defaultTZ);
}
}
示例7: before
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Override
protected void before() throws Throwable {
super.before();
DateTimeZone.setDefault(DateTimeZone.UTC);
}
示例8: after
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Override
protected void after() {
super.after();
DateTimeZone.setDefault(origDefault);
}
示例9: setDefaults
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
protected void setDefaults()
{
DateTimeZone.setDefault(DateTimeZone.UTC); //Joda
Locale.setDefault(Locale.UK);
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
示例10: SystemInitializer
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Inject
SystemInitializer(ActorSystem system,
ApplicationLifecycle lifecycle,
EmailComposer composer,
@Named("exam-auto-saver-actor") ActorRef examAutoSaver,
@Named("reservation-checker-actor") ActorRef reservationChecker,
@Named("auto-evaluation-notifier-actor") ActorRef autoEvaluationNotifier,
@Named("exam-expiration-actor") ActorRef examExpirationChecker,
@Named("assessment-sender-actor") ActorRef assessmentSender,
@Named("reservation-reminder-actor") ActorRef reservationReminder) {
this.system = system;
this.composer = composer;
String encoding = System.getProperty("file.encoding");
if (!encoding.equals("UTF-8")) {
Logger.warn("Default encoding is other than UTF-8 ({}). " +
"This might cause problems with non-ASCII character handling!", encoding);
}
System.setProperty("user.timezone", "UTC");
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
DateTimeZone.setDefault(DateTimeZone.forID("UTC"));
tasks.put("AUTO_SAVER", system.scheduler().schedule(
Duration.create(EXAM_AUTO_SAVER_START_AFTER_SECONDS, TimeUnit.SECONDS),
Duration.create(EXAM_AUTO_SAVER_INTERVAL_MINUTES, TimeUnit.MINUTES),
examAutoSaver, "tick",
system.dispatcher(), null
));
tasks.put("RESERVATION_POLLER", system.scheduler().schedule(
Duration.create(RESERVATION_POLLER_START_AFTER_SECONDS, TimeUnit.SECONDS),
Duration.create(RESERVATION_POLLER_INTERVAL_HOURS, TimeUnit.HOURS),
reservationChecker, "tick",
system.dispatcher(), null
));
tasks.put("EXPIRY_POLLER", system.scheduler().schedule(
Duration.create(EXAM_EXPIRY_POLLER_START_AFTER_SECONDS, TimeUnit.SECONDS),
Duration.create(EXAM_EXPIRY_POLLER_INTERVAL_DAYS, TimeUnit.DAYS),
examExpirationChecker, "tick",
system.dispatcher(), null
));
tasks.put("AUTOEVALUATION_NOTIFIER", system.scheduler().schedule(
Duration.create(AUTO_EVALUATION_NOTIFIER_START_AFTER_SECONDS, TimeUnit.SECONDS),
Duration.create(AUTO_EVALUATION_NOTIFIER_INTERVAL_MINUTES, TimeUnit.MINUTES),
autoEvaluationNotifier, "tick",
system.dispatcher(), null
));
tasks.put("EXTERNAL_EXAM_SENDER", system.scheduler().schedule(
Duration.create(ASSESSMENT_SENDER_START_AFTER_SECONDS, TimeUnit.SECONDS),
Duration.create(ASSESSMENT_SENDER_INTERVAL_HOURS, TimeUnit.HOURS),
assessmentSender, "tick", system.dispatcher(), null
));
tasks.put("RESERVATION_REMINDER", system.scheduler().schedule(
Duration.create(RESERVATION_REMINDER_START_AFTER_SECONDS, TimeUnit.SECONDS),
Duration.create(RESERVATION_REMINDER_INTERVAL_MINUTES, TimeUnit.MINUTES),
reservationReminder, "tick", system.dispatcher(), null
));
scheduleWeeklyReport();
lifecycle.addStopHook(() -> {
cancelTasks();
system.terminate();
return CompletableFuture.completedFuture(null);
});
}
示例11: before
import org.joda.time.DateTimeZone; //导入方法依赖的package包/类
@Before
public void before() {
DateTimeZone.setDefault(DateTimeZone.forID("America/Los_Angeles"));
}