List of usage examples for java.time Clock system
public static Clock system(ZoneId zone)
From source file:Main.java
public static void main(String[] args) { Clock clock = Clock.system(ZoneId.systemDefault()); System.out.println(clock);//ww w . j a va 2s .c om System.out.println(clock.instant()); }
From source file:Main.java
public static void main(String[] args) { // Time Zone/*from w ww . j a v a 2s. c o m*/ ZoneId zone = ZoneId.systemDefault(); System.out.println(Clock.system(zone)); System.out.println(Clock.system(ZoneId.of("Europe/Berlin"))); }
From source file:Main.java
public static String getCurrentTimeStamp() { Clock clock = Clock.system(ZoneId.of("Europe/Berlin")); ZonedDateTime now = ZonedDateTime.now(clock); return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(now); }
From source file:dragonrental.backend.DbConfig.java
public DragonManager dragonManager() { DragonManagerImpl dManager = new DragonManagerImpl(Clock.system(ZoneId.systemDefault())); dManager.setDataSource(ds);//from ww w . j a v a2 s .c om return dManager; }
From source file:com.coinkite.CoinkiteSigningRequestInterceptor.java
LocalDateTime getDateTime() { if (dateTime == null) { return LocalDateTime.now(Clock.system(ZoneId.of("UTC"))); }/* w w w. j a v a 2 s.c o m*/ return dateTime; }
From source file:org.openlmis.fulfillment.Application.java
/** * Creates new Clock. * * @return Created clock. */ @Bean public Clock clock() { return Clock.system(ZoneId.of(timeZoneId)); }
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 {//from ww w .j av a 2 s .com deviceClock = Clock.systemUTC(); LOG.warn("[Metron] No device time zone provided; defaulting to UTC"); } syslogParser = buildSyslogParser(parserConfig); }