Example usage for java.time Clock systemUTC

List of usage examples for java.time Clock systemUTC

Introduction

In this page you can find the example usage for java.time Clock systemUTC.

Prototype

public static Clock systemUTC() 

Source Link

Document

Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the UTC time-zone.

Usage

From source file:com.github.frankfarrell.snowball.Application.java

@Bean
public Clock clock() {
    return Clock.systemUTC();
}

From source file:keywhiz.ServiceModule.java

@Override
protected void configure() {
    // Initialize the BouncyCastle security provider for cryptography support.
    BouncyCastle.require();// w ww  . j  av  a 2s  .  co m

    bind(Clock.class).toInstance(Clock.systemUTC());

    install(new CookieModule(config.getCookieKey()));
    install(new CryptoModule(config.getDerivationProviderClass(), config.getContentKeyStore()));

    bind(CookieConfig.class).annotatedWith(SessionCookie.class).toInstance(config.getSessionCookieConfig());
    bind(CookieConfig.class).annotatedWith(Xsrf.class).toInstance(config.getXsrfCookieConfig());

    // TODO(justin): Consider https://github.com/HubSpot/dropwizard-guice.
    bind(Environment.class).toInstance(environment);
    bind(Configuration.class).toInstance(config);
    bind(KeywhizConfig.class).toInstance(config);
}

From source file:com.autodomum.core.event.EventContext.java

/**
 * Constructor with default UTC clock
 */
public EventContext() {
    this.clock = Clock.systemUTC();
}

From source file:org.mylab.consulclient.ConsulClient.java

public String listAllKeys() {
    logger.debug("listAllKeys called at " + Clock.systemUTC().instant().toString());
    String response = invokeConnector("?recurse");
    logger.debug(/*from   w w  w. ja  v  a 2s. c  o  m*/
            "listAllKeys returned response: " + response + " at: " + Clock.systemUTC().instant().toString());
    return response;
}

From source file:com.opentable.jaxrs.TestLZ4Encoding.java

@Before
public void setUp() throws Exception {
    final Config config = Config.getEmptyConfig();

    final Injector injector = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config),
            new HttpServerModule(config), new LifecycleModule(), new ServletModule() {
                @Override//w ww .j  a v a2s .  c  o  m
                public void configureServlets() {
                    binder().requireExplicitBindings();
                    binder().disableCircularProxies();

                    bind(Clock.class).toInstance(Clock.systemUTC());
                    bind(ContentServlet.class);
                    serve("/content").with(ContentServlet.class);
                }
            });

    injector.injectMembers(this);
    lifecycle.executeTo(LifecycleStage.START_STAGE);
    baseUri = format("http://localhost:%d/", pnp.getPort());
}

From source file:alfio.controller.api.support.PublicCategory.java

public boolean isFutureSale() {
    return ZonedDateTime.now(Clock.systemUTC()).isBefore(category.getUtcInception());
}

From source file:org.apache.metron.parsers.syslog.BaseSyslogParser.java

@Override
public void configure(Map<String, Object> parserConfig) {
    // we'll pull out the clock stuff ourselves
    String timeZone = (String) parserConfig.get("deviceTimeZone");
    if (timeZone != null)
        deviceClock = Clock.system(ZoneId.of(timeZone));
    else {/* w  ww  . j  a  v a  2 s  .  c  om*/
        deviceClock = Clock.systemUTC();
        LOG.warn("[Metron] No device time zone provided; defaulting to UTC");
    }
    syslogParser = buildSyslogParser(parserConfig);
}

From source file:org.mylab.consulclient.ConsulClient.java

public String getKey(String key) {
    logger.debug(// ww  w.  j av a2s  .co m
            "getKey called with a key value of: " + key + " at: " + Clock.systemUTC().instant().toString());
    String response = invokeConnector(key + "?raw");
    logger.debug("getKey returned response: " + response + " at: " + Clock.systemUTC().instant().toString());
    return response;
}

From source file:me.carbou.mathieu.tictactoe.di.ServiceBindings.java

@Override
protected void configure() {
    bind(Clock.class).toInstance(Clock.systemUTC()); // enabled override the whole system clock

    // bind security service and the way of getting a connected UserContext
    bind(SecurityService.class).to(DefaultSecurityService.class);
    bind(AccountRepository.class).to(MongoAccountRepository.class);
    bind(CredentialsMatcher.class).toInstance(new HashedCredentialsMatcher(3));
    bind(SessionConfigurations.class).toInstance(new SessionConfigurations().add("tic-tac-toe",
            new SessionConfiguration().setCheckOrigin(false).setCheckUserAgent(false)
                    .setMaxAge((int) Duration.ofDays(30).getSeconds())
                    .setCookieName(Env.isProduction() ? "id" : "id-" + Env.NAME).setCookiePath("/")
                    .setCookieDomain(Env.DOMAIN)));
}

From source file:org.apache.pulsar.broker.admin.v2.SchemasResource.java

public SchemasResource() {
    this(Clock.systemUTC());
}