java.time.Clock#systemDefaultZone ( )源码实例Demo

下面列出了java.time.Clock#systemDefaultZone ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: timbuctoo   文件: TinkerPopOperations.java
private TinkerPopOperations(TinkerPopGraphManager graphManager, Function<IndexHandler, ChangeListener> listener,
                            Function<IndexHandler, GremlinEntityFetcher> entityFetcher, Vres mappings,
                            IndexHandler indexHandler) {
  graph = graphManager.getGraph();
  this.transaction = graph.tx();
  if (transaction.isOpen()) {
    ownTransaction = false;
    LOG.error("There is already an open transaction", new Throwable()); //exception for the stack trace
  } else {
    ownTransaction = true;
    transaction.open();
  }
  this.indexHandler = indexHandler;
  this.listener = listener.apply(indexHandler);
  this.entityFetcher = entityFetcher.apply(indexHandler);

  this.traversal = graph.traversal();
  this.latestState = graphManager.getLatestState();
  this.mappings = mappings == null ? loadVres() : mappings;
  this.systemPropertyModifier = new SystemPropertyModifier(Clock.systemDefaultZone());
  this.graphDatabase = graphManager.getGraphDatabase(); //FIXME move to IndexHandler

}
 
源代码2 项目: util4j   文件: TimeIntroduction.java
public static void testClock() throws InterruptedException {
    //时钟提供给我们用于访问某个特定 时区的 瞬时时间、日期 和 时间的。  
    Clock c1 = Clock.systemUTC(); //系统默认UTC时钟(当前瞬时时间 System.currentTimeMillis())  
    System.out.println(c1.millis()); //每次调用将返回当前瞬时时间(UTC)  
    Clock c2 = Clock.systemDefaultZone(); //系统默认时区时钟(当前瞬时时间)  
    Clock c31 = Clock.system(ZoneId.of("Europe/Paris")); //巴黎时区  
    System.out.println(c31.millis()); //每次调用将返回当前瞬时时间(UTC)  
    Clock c32 = Clock.system(ZoneId.of("Asia/Shanghai"));//上海时区  
    System.out.println(c32.millis());//每次调用将返回当前瞬时时间(UTC)  
    Clock c4 = Clock.fixed(Instant.now(), ZoneId.of("Asia/Shanghai"));//固定上海时区时钟  
    System.out.println(c4.millis());
    Thread.sleep(1000);
    System.out.println(c4.millis()); //不变 即时钟时钟在那一个点不动  
    Clock c5 = Clock.offset(c1, Duration.ofSeconds(2)); //相对于系统默认时钟两秒的时钟  
    System.out.println(c1.millis());
    System.out.println(c5.millis());
}
 
源代码3 项目: timbuctoo   文件: TimbuctooActionsStubs.java
public static TimbuctooActions withDataStore(DataStoreOperations dataStoreOperations) {
  return new TimbuctooActions(
    mock(PermissionFetcher.class),
    Clock.systemDefaultZone(),
    mock(RedirectionService.class),
    (coll, id, rev) -> URI.create("http://example.org/persistent"),
    dataStoreOperations,
    new AfterSuccessTaskExecutor()
  );
}
 
源代码4 项目: che   文件: WorkspaceActivityChecker.java
@Inject
public WorkspaceActivityChecker(
    WorkspaceActivityDao activityDao,
    WorkspaceManager workspaceManager,
    WorkspaceRuntimes workspaceRuntimes,
    WorkspaceActivityManager workspaceActivityManager) {
  this(
      activityDao,
      workspaceManager,
      workspaceRuntimes,
      workspaceActivityManager,
      Clock.systemDefaultZone());
}
 
源代码5 项目: bisq   文件: ProtectedMailboxStorageEntryTest.java
private static ProtectedMailboxStorageEntry buildProtectedMailboxStorageEntry(
        MailboxStoragePayload mailboxStoragePayload, KeyPair ownerKey, PublicKey receiverKey, int sequenceNumber) throws CryptoException {
    byte[] hashOfDataAndSeqNr = P2PDataStorage.get32ByteHash(new P2PDataStorage.DataAndSeqNrPair(mailboxStoragePayload, sequenceNumber));
    byte[] signature = Sig.sign(ownerKey.getPrivate(), hashOfDataAndSeqNr);

    return new ProtectedMailboxStorageEntry(mailboxStoragePayload, ownerKey.getPublic(), sequenceNumber, signature, receiverKey, Clock.systemDefaultZone());
}
 
源代码6 项目: synapse   文件: CompactionService.java
public CompactionService(final SnapshotWriteService snapshotWriteService,
                         final StateRepository<String> stateRepository,
                         final EventSourceBuilder eventSourceBuilder,
                         final MessageLogReceiverEndpointFactory messageLogReceiverEndpointFactory)
{
    this(snapshotWriteService, stateRepository, eventSourceBuilder, messageLogReceiverEndpointFactory, Clock.systemDefaultZone());
}
 
源代码7 项目: kid-bank   文件: KidBankApplication.java
@Bean
public Clock clock() {
  return Clock.systemDefaultZone();
}
 
源代码8 项目: library   文件: DailySheetConfiguration.java
@Bean
DailySheet sheetsReadModel(JdbcTemplate jdbcTemplate) {
    return new SheetsReadModel(jdbcTemplate, Clock.systemDefaultZone());
}
 
源代码9 项目: timbuctoo   文件: EntityFinisherHelper.java
public EntityFinisherHelper() {
  this((collection, id, rev) -> URI.create("http://example.org"), Clock.systemDefaultZone(), "rdf-importer");
}
 
源代码10 项目: cqrs-hotel   文件: Application.java
@Bean
public Clock clock() {
    return Clock.systemDefaultZone();
}
 
源代码11 项目: Neo4jSNA   文件: Timer.java
protected Timer() {
	clock = Clock.systemDefaultZone();
}
 
源代码12 项目: jdk8u-jdk   文件: TCKClock_System.java
public void test_systemDefaultZone() {
    Clock test = Clock.systemDefaultZone();
    assertEquals(test.getZone(), ZoneId.systemDefault());
    assertEquals(test, Clock.system(ZoneId.systemDefault()));
}
 
@Bean
public Clock clock() {
	return Clock.systemDefaultZone();
}
 
源代码14 项目: immutables   文件: PersonGenerator.java
public PersonGenerator() {
  this(Clock.systemDefaultZone());
}
 
源代码15 项目: jdk8u-jdk   文件: TCKClock_System.java
public void test_systemDefaultZone() {
    Clock test = Clock.systemDefaultZone();
    assertEquals(test.getZone(), ZoneId.systemDefault());
    assertEquals(test, Clock.system(ZoneId.systemDefault()));
}
 
源代码16 项目: selenium   文件: WebDriverWait.java
/**
 * Wait will ignore instances of NotFoundException that are encountered (thrown) by default in
 * the 'until' condition, and immediately propagate all others.  You can add more to the ignore
 * list by calling ignoring(exceptions to add).
 *
 * @param driver The WebDriver instance to pass to the expected conditions
 * @param timeout The timeout when an expectation is called
 * @see WebDriverWait#ignoring(java.lang.Class)
 */
public WebDriverWait(WebDriver driver, Duration timeout) {
  this(
      driver,
      timeout,
      Duration.ofMillis(DEFAULT_SLEEP_TIMEOUT),
      Clock.systemDefaultZone(),
      Sleeper.SYSTEM_SLEEPER);
}
 
源代码17 项目: tutorials   文件: ClockUnitTest.java
@Test
public void givenClock_withSytemUTC_retrievesTimeInMillis() {
	
	Clock clockMillis = Clock.systemDefaultZone();

	assertEquals(clockMillis.instant().equals(null), false);
	assertTrue(clockMillis.millis() > 0);

	LOGGER.debug("System Default millis :: " + clockMillis.millis());
}
 
源代码18 项目: tutorials   文件: ClockUnitTest.java
@Test
public void givenClock_usingOffset_retrievesFutureDate() {
	
	Clock baseClock = Clock.systemDefaultZone();

	// result clock will be later than baseClock
	Clock futureClock = Clock.offset(baseClock, Duration.ofHours(72));

	assertEquals(futureClock.instant().equals(null), false);
	assertTrue(futureClock.millis() > baseClock.millis());

	LOGGER.debug("Future Clock instant :: " + futureClock.instant());
}
 
源代码19 项目: selenium   文件: AjaxElementLocator.java
/**
 * Use this constructor in order to process custom annotaions.
 *
 * @param context The context to use when finding the element
 * @param timeOutInSeconds How long to wait for the element to appear. Measured in seconds.
 * @param annotations	AbstractAnnotations class implementation
 */
public AjaxElementLocator(
    SearchContext context,
    int timeOutInSeconds,
    AbstractAnnotations annotations) {
  this(Clock.systemDefaultZone(), context, timeOutInSeconds, annotations);
}
 
源代码20 项目: selenium   文件: AjaxElementLocator.java
/**
 * Main constructor.
 *
 * @param searchContext The context to use when finding the element
 * @param field The field representing this element
 * @param timeOutInSeconds How long to wait for the element to appear. Measured in seconds.
 */
public AjaxElementLocator(SearchContext searchContext, Field field, int timeOutInSeconds) {
  this(Clock.systemDefaultZone(), searchContext, field, timeOutInSeconds);
}