當前位置: 首頁>>代碼示例>>Java>>正文


Java Clock.systemDefaultZone方法代碼示例

本文整理匯總了Java中java.time.Clock.systemDefaultZone方法的典型用法代碼示例。如果您正苦於以下問題:Java Clock.systemDefaultZone方法的具體用法?Java Clock.systemDefaultZone怎麽用?Java Clock.systemDefaultZone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.Clock的用法示例。


在下文中一共展示了Clock.systemDefaultZone方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import java.time.Clock; //導入方法依賴的package包/類
/**
 * Launch the application.
 * 
 * @throws Exception
 */
public static void main(String[] args) throws Exception {

    AppContext appContext = new AppContext(Clock.systemDefaultZone());

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                MainWindow window = new MainWindow(appContext);
                window.show();
            } catch (Exception e) {
                JOptionPane.showMessageDialog(
                    null,
                    Throwables.getStackTraceAsString(e),
                    "error:" + e.getMessage(),
                    JOptionPane.ERROR_MESSAGE);
                e.printStackTrace();
            }
        }
    });
}
 
開發者ID:SecureSkyTechnology,項目名稱:burpextender-proxyhistory-webui,代碼行數:27,代碼來源:GUIMain.java

示例2: testClock

import java.time.Clock; //導入方法依賴的package包/類
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());
}
 
開發者ID:juebanlin,項目名稱:util4j,代碼行數:18,代碼來源:TimeIntroduction.java

示例3: registerExtenderCallbacks

import java.time.Clock; //導入方法依賴的package包/類
@Override
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
    this.callbacks = callbacks;
    this.helpers = callbacks.getHelpers();
    callbacks.setExtensionName("ProxyHistoryWebUI");

    try {
        // ONLY THIS PATTERN WORK FINE. ?? ClassLoader.loadClass() NOT WORK... X(
        Class.forName("org.h2.Driver");

        appContext = new AppContext(Clock.systemDefaultZone());
        appContext.setConsoleOutputWriter(new PrintWriter(callbacks.getStdout(), true));
        appContext.setConsoleErrorWriter(new PrintWriter(callbacks.getStderr(), true));

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                demoPanel = new DemoPanel(appContext);
                callbacks.customizeUiComponent(demoPanel);
                callbacks.addSuiteTab(BurpExtender.this);

                // register ourselves as an HTTP listener
                callbacks.registerProxyListener(BurpExtender.this);
            }
        });
    } catch (Exception e) {
        callbacks.printError(Throwables.getStackTraceAsString(e));
        e.printStackTrace();
    }
}
 
開發者ID:SecureSkyTechnology,項目名稱:burpextender-proxyhistory-webui,代碼行數:31,代碼來源:BurpExtender.java

示例4: initSystemComponents

import java.time.Clock; //導入方法依賴的package包/類
private void initSystemComponents(final SystemComponents systemComponents) {
    client = systemComponents.client();
    pluginConfig = systemComponents.pluginConfig();
    infoStrategy = systemComponents.infoStrategy();
    clientUtil = systemComponents.clientUtil();
    zorro = new Zorro(pluginConfig);
    clock = Clock.systemDefaultZone();
}
 
開發者ID:juxeii,項目名稱:dztools,代碼行數:9,代碼來源:Components.java

示例5: systemClock

import java.time.Clock; //導入方法依賴的package包/類
@Bean
public Clock systemClock() {
    return Clock.systemDefaultZone();
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:5,代碼來源:TimeConfiguration.java

示例6: dailyInterestAmountShouldEqualTwoPenniesFor100PoundsAnd8Percent

import java.time.Clock; //導入方法依賴的package包/類
@Test
public void dailyInterestAmountShouldEqualTwoPenniesFor100PoundsAnd8Percent() {
    InterestCalculationService service = new InterestCalculationService(Clock.systemDefaultZone());

    BigDecimal dailyAmount = service.calculateDailyAmountFor(
        new BigDecimal("100.00"), EIGHT_PERCENT_INTEREST
    );

    assertThat(dailyAmount).isEqualTo("0.02");
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:11,代碼來源:InterestCalculationServiceDailyAmountCalculationTest.java

示例7: beforeEachTest

import java.time.Clock; //導入方法依賴的package包/類
@Before
public void beforeEachTest() {
    provider = new DefendantPinLetterContentProvider(notificationsProperties,
        new InterestContentProvider(
            new InterestCalculationService(Clock.systemDefaultZone())
        )
    );
    when(notificationsProperties.getFrontendBaseUrl()).thenReturn(FRONTEND_BASE_URL);
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:10,代碼來源:DefendantPinLetterContentProviderTest.java

示例8: shouldThrowNullPointerWhenGivenNullAmount

import java.time.Clock; //導入方法依賴的package包/類
@Test(expected = NullPointerException.class)
public void shouldThrowNullPointerWhenGivenNullAmount() {
    InterestCalculationService service = new InterestCalculationService(Clock.systemDefaultZone());
    service.calculateDailyAmountFor(null, HUNDRED_PERCENT_INTEREST);
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:6,代碼來源:InterestCalculationServiceDailyAmountCalculationTest.java

示例9: shouldThrowNullPointerWhenGivenNullInterest

import java.time.Clock; //導入方法依賴的package包/類
@Test(expected = NullPointerException.class)
public void shouldThrowNullPointerWhenGivenNullInterest() {
    InterestCalculationService service = new InterestCalculationService(Clock.systemDefaultZone());
    service.calculateDailyAmountFor(BigDecimal.TEN, null);
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:6,代碼來源:InterestCalculationServiceDailyAmountCalculationTest.java

示例10: setup

import java.time.Clock; //導入方法依賴的package包/類
@Before
public void setup() {
    this.provider = new ContentProvider(new InterestCalculationService(Clock.systemDefaultZone()));
}
 
開發者ID:hmcts,項目名稱:cmc-claim-store,代碼行數:5,代碼來源:ContentProviderTest.java

示例11: TimeBasedCache

import java.time.Clock; //導入方法依賴的package包/類
TimeBasedCache(Duration minTimeBetweenReloads, Supplier<Map<K, V>> valuesSupplier)
{
    this(minTimeBetweenReloads, valuesSupplier, Collections.emptyMap(), Clock.systemDefaultZone());
}
 
開發者ID:curityio,項目名稱:oauth-filter-for-java,代碼行數:5,代碼來源:TimeBasedCache.java

示例12: eventSource

import java.time.Clock; //導入方法依賴的package包/類
@Override
public EventSource eventSource() {
    return new FlatFilesystemEventSource(folder.getRoot().toPath(), Clock.systemDefaultZone(), ".json");
}
 
開發者ID:tim-group,項目名稱:tg-eventstore,代碼行數:5,代碼來源:FlatFilesystemEventSourceTest.java

示例13: clock

import java.time.Clock; //導入方法依賴的package包/類
@Bean
public Clock clock() {
    return Clock.systemDefaultZone();
}
 
開發者ID:university-information-system,項目名稱:uis,代碼行數:5,代碼來源:ClockConfig.java

示例14: RequestStatusLoggingFilter

import java.time.Clock; //導入方法依賴的package包/類
public RequestStatusLoggingFilter() {
    this(Clock.systemDefaultZone());
}
 
開發者ID:hmcts,項目名稱:java-logging,代碼行數:4,代碼來源:RequestStatusLoggingFilter.java

示例15: getSystemClock

import java.time.Clock; //導入方法依賴的package包/類
@Provides
private Clock getSystemClock() {
    return Clock.systemDefaultZone();
}
 
開發者ID:ccremer,項目名稱:clustercode,代碼行數:5,代碼來源:GlobalModule.java


注:本文中的java.time.Clock.systemDefaultZone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。